external-process-wait: check code after status change
authorDaniel Kochmański <daniel@turtleware.eu>
Fri, 11 Sep 2015 09:49:02 +0000 (11:49 +0200)
committerDaniel Kochmański <daniel@turtleware.eu>
Fri, 11 Sep 2015 09:49:02 +0000 (11:49 +0200)
Related to #149

Signed-off-by: Daniel Kochmański <daniel@turtleware.eu>
src/c/unixsys.d

index 981a25b..f5c1ee2 100644 (file)
@@ -356,10 +356,10 @@ make_windows_handle(HANDLE h)
                  * here: status is updated _after_ code, and hence we
                  * check it _before_ code. */
                 do {
-                        status = external_process_status(process);
-                        code = external_process_code(process);
                         ecl_musleep(0.0, 1);
+                        status = external_process_status(process);
                 } while (status == @':running');
+                code = external_process_code(process);
         } else {
                 status = ecl_waitpid(pid, wait);
                 code = ecl_nth_value(the_env, 1);