Merge pull request #6037 from MikeMcQuaid/test-improve-timeout-handling

test: kill all subprocesses on timeout.
This commit is contained in:
Mike McQuaid 2019-04-19 15:43:12 +09:00 committed by GitHub
commit 7706e225a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,5 +30,12 @@ begin
rescue Exception => e # rubocop:disable Lint/RescueException
error_pipe.puts e.to_json
error_pipe.close
pid = Process.pid.to_s
if which("pgrep") && which("pkill") && system("pgrep", "-qP", pid)
$stderr.puts "Killing child processes..."
system "pkill", "-P", pid
sleep 1
system "pkill", "-9", "-P", pid
end
exit! 1
end