Skip to content

Instantly share code, notes, and snippets.

@Tak
Created August 13, 2014 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tak/bf3ff96173cc34dcd613 to your computer and use it in GitHub Desktop.
Save Tak/bf3ff96173cc34dcd613 to your computer and use it in GitHub Desktop.
diff --git a/mono/io-layer/processes.c b/mono/io-layer/processes.c
index 02665dd..25af22d 100644
--- a/mono/io-layer/processes.c
+++ b/mono/io-layer/processes.c
@@ -1723,6 +1723,7 @@ gboolean GetExitCodeProcess (gpointer process, guint32 *code)
if(code==NULL) {
return(FALSE);
}
+ *code = STILL_ACTIVE;
if ((GPOINTER_TO_UINT (process) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED) {
/* This is a pseudo handle, so we don't know what the
@@ -1747,13 +1748,8 @@ gboolean GetExitCodeProcess (gpointer process, guint32 *code)
/* Make sure any process exit has been noticed, before
* checking if the process is signalled. Fixes bug 325463.
*/
- process_wait (process, 0);
-
- if (_wapi_handle_issignalled (process) == TRUE) {
+ if (WAIT_OBJECT_0 == process_wait (process, 0) && _wapi_handle_issignalled (process) == TRUE)
*code = process_handle->exitstatus;
- } else {
- *code = STILL_ACTIVE;
- }
return(TRUE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment