Index: third-party/chicken/posixwin.scm
===================================================================
--- third-party/chicken/posixwin.scm	(revision 145203)
+++ third-party/chicken/posixwin.scm	(revision 145204)
@@ -92,6 +92,7 @@
 static C_TLS HANDLE C_save0, C_save1; /* saved I/O handles */
 static C_TLS char C_rdbuf; /* one-char buffer for read */
 static C_TLS int C_exstatus;
+static C_TLS HANDLE C_pid;
 
 /* platform information; initialized for cached testing */
 static C_TLS char C_hostname[256] = "";
@@ -318,15 +319,22 @@
 static int C_fcall
 process_wait(C_word h, C_word t)
 {
-    if (WaitForSingleObject((HANDLE)h, (t ? 0 : INFINITE)) == WAIT_OBJECT_0)
+    DWORD wait_result = WaitForSingleObject((HANDLE)h, (t ? 0 : INFINITE));
+    DWORD ret;
+    switch (wait_result)
     {
-	DWORD ret;
-	if (GetExitCodeProcess((HANDLE)h, &ret))
-	{
-	    CloseHandle((HANDLE)h);
-	    C_exstatus = ret;
-	    return 1;
-	}
+        case WAIT_OBJECT_0:
+            if (GetExitCodeProcess((HANDLE)h, &ret))
+            {
+                CloseHandle((HANDLE)h);
+                C_exstatus = ret;
+                C_pid = (HANDLE)h;
+                return 1;
+            }
+            break;
+        case WAIT_TIMEOUT:
+            C_pid = 0;
+            return 1;
     }
     return set_last_errno();
 }
@@ -1267,10 +1275,11 @@
       (%process 'process* #t cmd args env exactf) )) )
 
 (define-foreign-variable _exstatus int "C_exstatus")
+(define-foreign-variable _pid int "C_pid")
 
 (define (##sys#process-wait pid nohang)
   (if (##core#inline "C_process_wait" pid nohang)
-    (values pid #t _exstatus)
+    (values _pid #t _exstatus)
     (values -1 #f #f) ) )
 
 (define (sleep s)
