summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/winwait.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1997-09-03 14:38:02 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1997-09-03 14:38:02 +0000
commit1e664b94467a65841e63d2dea50cd1f64e8a3258 (patch)
tree377f874869769eb40984803bcc6b6648a06b68e4 /otherlibs/win32unix/winwait.c
parent47745356d34649ee4c531fea679e3a008cf90197 (diff)
Implementation du type file_descr par le type HANDLE de Win32. Court-circuite la libc de MSVC.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1700 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32unix/winwait.c')
-rw-r--r--otherlibs/win32unix/winwait.c13
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;