diff options
author | Peter Bex <peter@more-magic.net> | 2012-10-04 19:32:26 +0200 |
---|---|---|
committer | Peter Bex <peter@more-magic.net> | 2012-10-04 19:32:26 +0200 |
commit | 30c3224e11d0d0ec4437bf00c1a6e397750c88b9 (patch) | |
tree | 1100882a59dfbe9a3ef7a5982d9c425f41ee59b7 /scsh-process.scm | |
parent | 787b65c4ebebe831006b0a1796c79ac535744db9 (diff) | |
download | scsh-process-30c3224e11d0d0ec4437bf00c1a6e397750c88b9.tar.gz |
Reorder return values of process-wait; we shouldn't mess with that!
Diffstat (limited to 'scsh-process.scm')
-rw-r--r-- | scsh-process.scm | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/scsh-process.scm b/scsh-process.scm index d815e6c..e60fb67 100644 --- a/scsh-process.scm +++ b/scsh-process.scm @@ -90,23 +90,24 @@ (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 @@ -213,9 +214,9 @@ (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) @@ -297,7 +298,10 @@ (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 |