Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
native: Use WNOHANG before signaling
It turns out that on linux, and possibly other platforms, child processes will continue to accept signals until they have been *reaped*. This means that once the child has exited, it will succeed to receive signals until waitpid() has been invoked on it. This is unfortunate behavior, and differs from what is seen on OSX and windows. This commit changes the behavior of Process::signal() to be the same across platforms, and updates the documentation of Process::kill() to note that when signaling a foreign process it may accept signals until reaped. Implementation-wise, this invokes waitpid() with WNOHANG before each signal to the child to ensure that if the child has exited that we will reap it. Other possibilities include installing a SIGCHLD signal handler, but at this time I believe that that's too complicated. Closes #13124
- Loading branch information
1 parent
b8601a3
commit 0e190b9
Showing
4 changed files
with
116 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0e190b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from brson
at alexcrichton@0e190b9
0e190b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/issue-13124 = 0e190b9 into auto
0e190b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/issue-13124 = 0e190b9 merged ok, testing candidate = fd4f15e
0e190b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/4939
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/4942
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/4033
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/4045
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/5041
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/4126
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/4134
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/5041
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/4126
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/4131
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/4197
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1929
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/5038
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/4136
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/4146
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/4803
0e190b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = fd4f15e