diff options
Diffstat (limited to 'otherlibs/win32unix/winwait.c')
-rw-r--r-- | otherlibs/win32unix/winwait.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/otherlibs/win32unix/winwait.c b/otherlibs/win32unix/winwait.c index 07bed46f1..c33f356ae 100644 --- a/otherlibs/win32unix/winwait.c +++ b/otherlibs/win32unix/winwait.c @@ -22,11 +22,18 @@ static value alloc_process_status(pid, status) int pid, status; { - value res; - value st = alloc(1, 0); + value res, st; + if ((status & 0xFF) == 0) { + /* Normal termination: lo-byte = 0, hi-byte = child exit code */ + st = alloc(1, 0); + Field(st, 0) = Val_int(status >> 8); + } else { + /* Abnormal termination: lo-byte = term status, hi-byte = 0 */ + st = alloc(1, 1); + Field(st, 0) = Val_int(status & 0xFF); + } Begin_root (st); - Field(st, 0) = Val_int(status); res = alloc_tuple(2); Field(res, 0) = Val_int(pid); Field(res, 1) = st; |