Fix error message on ctrl-c - patch from komh

(cherry picked from commit 9794c160f676c32d6ebb155a21f0891166189939)
This commit is contained in:
Paul Smedley
2012-07-07 19:14:14 +09:30
committed by Dmitriy Kuminov
parent e9ab217fcb
commit 55ad0e757f

View File

@@ -365,9 +365,6 @@ pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
pid_t ret;
struct rusage r;
if (time == NULL)
return waitpid (pid, status, 0);
ret = wait4 (pid, status, 0, &r);
if (time != NULL)
@@ -378,6 +375,19 @@ pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
time->system_microseconds= r.ru_stime.tv_usec;
}
/* Suppress 'Internal error: Interrupt' caused by Ctrl-C and Ctrl-Break */
if (status && WIFSIGNALED (*status))
{
switch (WTERMSIG (*status))
{
case SIGINT: /* Ctrl-C */
case SIGBREAK: /* Ctrl-Break */
/* Clear a signaled status and use SIGINT as a return code */
*status = SIGINT << 8;
break;
}
}
return ret;
}