1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

envutil.rb: kill child

* test/ruby/envutil.rb (EnvUtil#invoke_ruby): kill the child process
  certainly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-12-09 14:34:33 +00:00
parent 29756c5e94
commit 0c0496ebd2

View file

@ -44,6 +44,7 @@ module EnvUtil
err_p.set_encoding(enc) if err_p
end
timeout = opt.delete(:timeout) || 10
reprieve = opt.delete(:reprieve) || 1
c = "C"
child_env = {}
LANG_ENVS.each {|lc| child_env[lc] = c}
@ -70,7 +71,9 @@ module EnvUtil
begin
Process.kill signal, pid
rescue Errno::ESRCH
end
break
else
end until signal == :KILL or (sleep reprieve; signal = :KILL; false)
raise Timeout::Error
end
out_p.close if capture_stdout