Commit 91dce34f by Calen Pennington

Be more graceful when terminating background processes

parent 352a4da5
......@@ -37,6 +37,15 @@ def background_process(*command)
pgid = Process.getpgid(pid)
begin
Timeout.timeout(5) do
puts "Interrupting process group #{pgid}"
Process.kill(:SIGINT, -pgid)
puts "Waiting on process group #{pgid}"
Process.wait(-pgid)
puts "Done waiting on process group #{pgid}"
end
rescue Timeout::Error
begin
Timeout.timeout(5) do
puts "Terminating process group #{pgid}"
Process.kill(:SIGTERM, -pgid)
puts "Waiting on process group #{pgid}"
......@@ -51,6 +60,7 @@ def background_process(*command)
puts "Done waiting on process group #{pgid}"
end
end
end
end
def environments(system)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment