summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scsh-process.scm10
1 files changed, 6 insertions, 4 deletions
diff --git a/scsh-process.scm b/scsh-process.scm
index 2810baf..0676681 100644
--- a/scsh-process.scm
+++ b/scsh-process.scm
@@ -121,11 +121,13 @@
(scsh-process-ok? p)
(scsh-process-pid p))
(if (and p (not nohang))
- (let ((m (make-mutex)))
+ (let lp ((m (make-mutex)))
(mutex-unlock! m (scsh-process-child-condition p))
- (values (scsh-process-exit-status p)
- (scsh-process-ok? p)
- (scsh-process-pid p)))
+ (if (not (scsh-process-exit-status p))
+ (lp m) ; might have been forcibly unblocked
+ (values (scsh-process-exit-status p)
+ (scsh-process-ok? p)
+ (scsh-process-pid p))))
(handle-exceptions exn
(if (and p (scsh-process-exit-status p)) ; Signal might've occurred
(values (scsh-process-exit-status p)