Added functionality to handle unexpected termination when using local worker
This commit is contained in:
parent
8a536781b2
commit
5f0b8dc4a5
|
@ -40,8 +40,10 @@ module Hydra #:nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
def reg_trap_sighup
|
def reg_trap_sighup
|
||||||
trap :SIGHUP do
|
for sign in [:SIGHUP, :INT]
|
||||||
stop
|
trap sign do
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue