From 028953fa66cac3ec10a922b08fe715d2a74dc905 Mon Sep 17 00:00:00 2001 From: Tom Werner Date: Mon, 10 Sep 2007 18:37:00 -0700 Subject: [PATCH] fix process#alive? to not raise on no such file --- History.txt | 8 ++++++++ Rakefile | 2 +- lib/god.rb | 2 +- lib/god/process.rb | 8 ++++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/History.txt b/History.txt index a6925f8..87facfb 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,11 @@ +== 0.4.3 +* Bug Fixes + * fix Process#alive? to not raise on no such file + +== 0.4.2 +* Bug Fixes + * fix netlink events [dkresge] + == 0.4.1 * Bug Fixes * require 'stringio' for ruby 1.8.5 diff --git a/Rakefile b/Rakefile index d188660..2f059b3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ require 'rubygems' require 'hoe' -Hoe.new('god', '0.4.2') do |p| +Hoe.new('god', '0.4.3') do |p| p.rubyforge_name = 'god' p.author = 'Tom Preston-Werner' p.email = 'tom@rubyisawesome.com' diff --git a/lib/god.rb b/lib/god.rb index 86ac1eb..136de98 100644 --- a/lib/god.rb +++ b/lib/god.rb @@ -61,7 +61,7 @@ module Kernel end module God - VERSION = '0.4.2' + VERSION = '0.4.3' LOG = Logger.new diff --git a/lib/god/process.rb b/lib/god/process.rb index d06cd29..224d66b 100644 --- a/lib/god/process.rb +++ b/lib/god/process.rb @@ -12,8 +12,12 @@ module God end def alive? - pid = File.read(self.pid_file).strip.to_i - System::Process.new(pid).exists? + begin + pid = File.read(self.pid_file).strip.to_i + System::Process.new(pid).exists? + rescue Errno::ENOENT + false + end end def valid? -- 2.11.4.GIT