Commit 54038240 authored by Simon Marlow's avatar Simon Marlow
Browse files

Use (128+signal) as the exit code when a proc terminates due to a signal (#7229)

parent 0cae6ea0
......@@ -22,6 +22,13 @@
UNIX versions
------------------------------------------------------------------------- */
//
// If a process terminates with a signal, the exit status we return to
// via the System.Process API follows the Unix shell convention of
// (128 + signal).
//
#define TERMSIG_STATUS(r) ((r) | 0x80)
static long max_fd = 0;
// Rts internal API, not exposed in a public header file:
......@@ -245,8 +252,8 @@ getProcessExitCode (ProcHandle handle, int *pExitCode)
else
if (WIFSIGNALED(wstat))
{
errno = EINTR;
return -1;
*pExitCode = TERMSIG_STATUS(WTERMSIG(wstat));
return 1;
}
else
{
......@@ -281,7 +288,7 @@ int waitForProcess (ProcHandle handle, int *pret)
else
if (WIFSIGNALED(wstat))
{
*pret = wstat;
*pret = TERMSIG_STATUS(WTERMSIG(wstat));
return 0;
}
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment