Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,26 @@ private bool TryReapChild(bool configureConsole)
}
else
{
// Unexpected.
int errorCode = Marshal.GetLastWin32Error();
Environment.FailFast("Error while reaping child. errno = " + errorCode);
// waitpid returned -1
Interop.Error error = Interop.Sys.GetLastError();
if (error == Interop.Error.ECHILD)
{
// The child was already reaped by another waitpid call
// (e.g., by an original SIGCHLD handler invoked before
// the .NET handler, or by native code in the process).
// The exit code is unavailable since it was consumed by
// the other waiter; we leave _exitCode as null, similar
// to CheckForNonChildExit.
if (_usesTerminal)
{
Process.ConfigureTerminalForChildProcesses(-1, configureConsole);
}

SetExited();
return true;
}

Environment.FailFast("Error while reaping child. errno = " + Marshal.GetLastWin32Error());
}
return false;
}
Expand Down
Loading