mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Run rb_syswait on exec failure
not only when !w but also when w == WAITPID_LOCK_ONLY. See also:f7c0cc3692
anda226434206
. We thought this change was an oversight in the latter commit. Without this change, the test fails like: $ make test-all TESTS="../test/ruby/test_process.rb -n test_exec_failure_leaves_no_child" RUN_OPTS="--jit" ... 1) Failure: TestProcess#test_exec_failure_leaves_no_child [/home/k0kubun/src/github.com/ruby/ruby/test/ruby/test_process.rb:2493]: Expected [[26799, #<Process::Status: pid 26799 exit 127>]] to be empty. Co-Authored-By: Yusuke Endoh <mame@ruby-lang.org>
This commit is contained in:
parent
50a6d292c0
commit
967ae6278f
3 changed files with 8 additions and 9 deletions
|
@ -4046,7 +4046,7 @@ fork_check_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg,
|
|||
"only used by extensions");
|
||||
rb_protect(proc_syswait, (VALUE)pid, status);
|
||||
}
|
||||
else if (!w) {
|
||||
else if (!w || w == WAITPID_LOCK_ONLY) {
|
||||
rb_syswait(pid);
|
||||
}
|
||||
errno = err;
|
||||
|
|
|
@ -2485,4 +2485,11 @@ EOS
|
|||
Process.wait spawn(RUBY, "-e", "exit 13")
|
||||
assert_same(Process.last_status, $?)
|
||||
end
|
||||
|
||||
def test_exec_failure_leaves_no_child
|
||||
assert_raise(Errno::ENOENT) do
|
||||
spawn('inexistent_command')
|
||||
end
|
||||
assert_empty(Process.waitall)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,14 +14,6 @@ class TestGemExtCmakeBuilder < Gem::TestCase
|
|||
_, status = Open3.capture2e('cmake')
|
||||
skip 'cmake not present' unless status.success?
|
||||
rescue Errno::ENOENT
|
||||
# Open3.capture2e with ENOENT with JIT enabled leaves a zombie process.
|
||||
# TODO: avoid making the zombie on ENOENT with JIT
|
||||
if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
|
||||
begin
|
||||
Process.waitall
|
||||
rescue Errno::ECHILD
|
||||
end
|
||||
end
|
||||
skip 'cmake not present'
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue