Commits

Peter Bex committed d42db5d

Reorder return values of process-wait; we shouldn't mess with that!

  • Participants
  • Parent commits c342938

Comments (0)

Files changed (1)

File scsh-process.scm

                        (hash-table-ref/default *scsh-pending-processes*
                                                pid-or-process #f)
                        pid-or-process)))
-            (or (and p (scsh-process-exit-status p))
+            (if (and p (scsh-process-exit-status p))
+                (values (scsh-process-pid p)
+                        (scsh-process-ok? p)
+                        (scsh-process-exit-status p))
                 (handle-exceptions exn
                   (if (and p (scsh-process-exit-status p)) ; Signal might've occurred
-                      (values (scsh-process-exit-status p)
+                      (values (scsh-process-pid p)
                               (scsh-process-ok? p)
-                              (scsh-process-pid p))
+                              (scsh-process-exit-status p))
                       (abort exn))
                   (receive (pid ok? status)
                     (posix-process-wait (and p (scsh-process-pid p)))
-                    (cond
-                     ((zero? pid) (values #f #f #f))
-                     (else
+                    (unless (zero? pid)
                       (when p
                         (scsh-process-exit-status-set! p status)
                         (scsh-process-ok?-set! p ok?))
-                      (remove-scsh-pending-process! pid)
-                      (values status ok? pid)))))))))
+                      (remove-scsh-pending-process! pid))
+                    (values pid ok? status)))))))
 
   (set-signal-handler!
    signal/chld
          (conns (map (lambda (from-fd temp-file)
                        (list from-fd (port->fileno temp-file)))
                      fds temp-files)))
-    (receive (code ok? pid)
+    (receive (pid ok? status)
       (process-wait (fork/pipe+ conns thunk))
-      (apply values code temp-files))))
+      (apply values status temp-files))))
 
 (define (run/port* thunk)
   (receive (in out)
 
 (define-syntax run
   (syntax-rules ()
-    ((_ ?epf ...) (process-wait (& ?epf ...)))))
+    ((_ ?epf ...)
+     (receive (pid ok? status)
+       (process-wait (& ?epf ...))
+       (values status ok? pid)))))
 
 ;; Perhaps this should really be a procedure?
 (define-syntax setup-redirection