From 5d1096db96ef1e91046cd1475b78d7734db55464 Mon Sep 17 00:00:00 2001 From: Jonathan del Strother Date: Thu, 4 Jul 2019 14:38:08 +0100 Subject: [PATCH] Fix ChildProcess::Unix::Process#exited? method with leader processes After sending TERM to a leader process, `::Process.waitpid2(_pid, ::Process::WNOHANG | ::Process::WUNTRACED)` appears to just return nil under ruby 2.6. This causes process.stop to send TERM to the process, poll (unsuccessfully) for the exit status until the timeout is hit, then send KILL. --- lib/childprocess/unix/process.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/childprocess/unix/process.rb b/lib/childprocess/unix/process.rb index 5b72a59..5933060 100644 --- a/lib/childprocess/unix/process.rb +++ b/lib/childprocess/unix/process.rb @@ -29,7 +29,7 @@ def exited? return true if @exit_code assert_started - pid, status = ::Process.waitpid2(_pid, ::Process::WNOHANG | ::Process::WUNTRACED) + pid, status = ::Process.waitpid2(@pid, ::Process::WNOHANG | ::Process::WUNTRACED) pid = nil if pid == 0 # may happen on jruby log(:pid => pid, :status => status)