better handling of Interrupt rescues

This commit is contained in:
David Dollar
2010-10-15 16:06:06 -07:00
parent 0c2b2a4ac2
commit 0ae144e468

View File

@@ -84,18 +84,21 @@ private ######################################################################
def run(process, log_to_file=true)
proctitle "ruby: foreman #{process.name}"
Dir.chdir directory do
FileUtils.mkdir_p "log"
command = process.command
begin
Dir.chdir directory do
FileUtils.mkdir_p "log"
command = process.command
begin
PTY.spawn("#{process.command} 2>&1") do |stdin, stdout, pid|
until stdin.eof?
info stdin.gets, process
end
end
rescue PTY::ChildExited, Interrupt
info "process exiting", process rescue nil
end
rescue PTY::ChildExited, Interrupt
begin
info "process exiting", process
rescue Interrupt
end
end
end