diff --git a/core/engine/io_basic.c b/core/engine/io_basic.c index b4b43f089..ca0c9a1c9 100644 --- a/core/engine/io_basic.c +++ b/core/engine/io_basic.c @@ -1780,7 +1780,7 @@ CBOOL__PROTO(prolog_set_unbuf) { CBOOL__PROTO(prolog_input_wait) { ERR__FUNCTOR("io_basic:$input_wait", 3); #if defined(_WIN32) || defined(_WIN64) /* MinGW */ -#warning "io_basic:$input_wait is not supported in the Win32 build" /* TODO:[JF] fixme */ +#warning "TODO(MinGW): we need select() in io_basic:$input_wait" CBOOL__PROCEED; #else int errcode; diff --git a/core/engine/system.c b/core/engine/system.c index d74de34ae..b0ae3ad60 100644 --- a/core/engine/system.c +++ b/core/engine/system.c @@ -2153,6 +2153,14 @@ CBOOL__PROTO(prolog_wait) { } int retcode; +#if defined(_WIN32) || defined(_WIN64) + // Windows-specific process termination handling + if (status & 0xC0000000) { /* error */ + retcode = -(status & 0xC0000000); /* negative number for signals */ + } else { + retcode = status; /* Process terminated normally */ + } +#else /* Process did not terminated normally */ if (WIFSIGNALED(status)) { /* Process terminated due to signal */ retcode = -WTERMSIG(status); /* negative number for signals */ @@ -2162,6 +2170,7 @@ CBOOL__PROTO(prolog_wait) { // TODO: only if WIFSTOPPED(status) (see man page) return FALSE; } +#endif CBOOL__LASTUNIFY(X(1), MakeSmall(retcode)); }