diff options
-rw-r--r-- | process.c | 2 | ||||
-rw-r--r-- | test/ruby/test_process.rb | 7 | ||||
-rw-r--r-- | test/rubygems/test_gem_ext_cmake_builder.rb | 8 |
3 files changed, 8 insertions, 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; diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 7bcfa48f4f..9d0ee6708a 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -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 diff --git a/test/rubygems/test_gem_ext_cmake_builder.rb b/test/rubygems/test_gem_ext_cmake_builder.rb index d056202cc0..b3f9241a96 100644 --- a/test/rubygems/test_gem_ext_cmake_builder.rb +++ b/test/rubygems/test_gem_ext_cmake_builder.rb @@ -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 |