Skip to content

Commit

Permalink
Fix ChildProcess::Unix::Process#wait method with leader processes
Browse files Browse the repository at this point in the history
Issue #151 reported a problem where in the update from Ruby 2.5 to Ruby
2.6 some programs would block forever on a `Process.waitpid2` call.

Changing the call to pass in a positive PID instead of the negative PID
fixes the issue as it will call the `waitpid` system call right away
instead of delaying it for later.

See #151 for further discussion of the possible reasons for the
behavior.
  • Loading branch information
sds committed Jun 4, 2019
1 parent 982b1ae commit e2878af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/childprocess/unix/process.rb
Expand Up @@ -50,7 +50,8 @@ def wait
if exited?
exit_code
else
_, status = ::Process.waitpid2 _pid
_, status = ::Process.waitpid2(@pid)

set_exit_code(status)
end
end
Expand Down

0 comments on commit e2878af

Please sign in to comment.