Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

[release/2.1] Fix Process.ExitCode on mac for killed processes (#29407) #29445

Merged
merged 1 commit into from
May 2, 2018

Conversation

joperezr
Copy link
Member

@joperezr joperezr commented May 1, 2018

This is a port of #29407 into the release/2.1 branch that will fix a regression on Process.ExitCode on mac for processes that are killed.

There was one small merge conflict on

https://github.com/joperezr/corefx/blob/806c5b270e299a8b4a06310c192b4e612f9e8607/src/Native/Unix/System.Native/pal_process.h#L215-L225

that required me to get rid of the DLLEXPORT keywords at the beginning of those two functions. Nothing else had to be changed.

cc: @tmds @stephentoub @danmosemsft @wtgodbe

Fixes: #29370

Master PR commit message:

  • Fix Process.ExitCode on mac for killed processes
    Use SIGCHLD to trigger Process waitpid check #26291 changed process reaping
    from using waitpid to waitid. This caused a regression on mac, since
    for processes that are killed, (on mac) waitid does not return the
    signal number that caused the process to terminated.
    We change back to waitpid for reaping children and determining the
    exit code. waitid is used to find terminated children.
    Fixes https://github.com/dotnet/corefx/issues/29370
  • TestExitCodeKilledChild: remove runtime check
  • TestExitCodeKilledChild: remove greater than assert

* Fix Process.ExitCode on mac for killed processes

dotnet#26291 changed process reaping
from using waitpid to waitid. This caused a regression on mac, since
for processes that are killed, (on mac) waitid does not return the
signal number that caused the process to terminated.

We change back to waitpid for reaping children and determining the
exit code. waitid is used to find terminated children.

Fixes https://github.com/dotnet/corefx/issues/29370

* TestExitCodeKilledChild: remove runtime check

* TestExitCodeKilledChild: remove greater than assert
@wtgodbe
Copy link
Member

wtgodbe commented May 1, 2018

Thanks Jose! Did you also send email to shiproom?

@joperezr
Copy link
Member Author

joperezr commented May 1, 2018

@wtgodbe doing that now 😄

@stephentoub stephentoub changed the title Fix Process.ExitCode on mac for killed processes (#29407) [release/2.1] Fix Process.ExitCode on mac for killed processes (#29407) May 1, 2018
Copy link
Member

@tmds tmds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@stephentoub stephentoub merged commit 484f904 into dotnet:release/2.1 May 2, 2018
@karelz karelz added this to the 2.1.0 milestone May 5, 2018
@joperezr joperezr deleted the PortProcessFix branch November 2, 2018 20:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants