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:
parent
29756c5e94
commit
0c0496ebd2
1 changed files with 4 additions and 1 deletions
|
@ -44,6 +44,7 @@ module EnvUtil
|
||||||
err_p.set_encoding(enc) if err_p
|
err_p.set_encoding(enc) if err_p
|
||||||
end
|
end
|
||||||
timeout = opt.delete(:timeout) || 10
|
timeout = opt.delete(:timeout) || 10
|
||||||
|
reprieve = opt.delete(:reprieve) || 1
|
||||||
c = "C"
|
c = "C"
|
||||||
child_env = {}
|
child_env = {}
|
||||||
LANG_ENVS.each {|lc| child_env[lc] = c}
|
LANG_ENVS.each {|lc| child_env[lc] = c}
|
||||||
|
@ -70,7 +71,9 @@ module EnvUtil
|
||||||
begin
|
begin
|
||||||
Process.kill signal, pid
|
Process.kill signal, pid
|
||||||
rescue Errno::ESRCH
|
rescue Errno::ESRCH
|
||||||
end
|
break
|
||||||
|
else
|
||||||
|
end until signal == :KILL or (sleep reprieve; signal = :KILL; false)
|
||||||
raise Timeout::Error
|
raise Timeout::Error
|
||||||
end
|
end
|
||||||
out_p.close if capture_stdout
|
out_p.close if capture_stdout
|
||||||
|
|
Loading…
Reference in a new issue