Added functionality to handle unexpected termination when using local worker

This commit is contained in:
Arturo Pie 2011-06-06 11:44:12 -04:00
parent 8a536781b2
commit 5f0b8dc4a5
1 changed files with 6 additions and 2 deletions

View File

@ -40,9 +40,11 @@ module Hydra #:nodoc:
end end
def reg_trap_sighup def reg_trap_sighup
trap :SIGHUP do for sign in [:SIGHUP, :INT]
trap sign do
stop stop
end end
end
@runner_began = true @runner_began = true
end end
@ -295,6 +297,8 @@ module Hydra #:nodoc:
begin begin
$stderr = $stdout = File.open(file_name, 'a') $stderr = $stdout = File.open(file_name, 'a')
rescue rescue
# it should always redirect output in order to handle unexpected interruption
# successfully
$stderr = $stdout = File.open(DEFAULT_LOG_FILE, 'a') $stderr = $stdout = File.open(DEFAULT_LOG_FILE, 'a')
end end
end end