summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scsh-process.scm2
-rw-r--r--tests/run.scm12
2 files changed, 13 insertions, 1 deletions
diff --git a/scsh-process.scm b/scsh-process.scm
index b3f7fd1..d54f162 100644
--- a/scsh-process.scm
+++ b/scsh-process.scm
@@ -178,7 +178,7 @@
(scsh-process-ok? p)
(scsh-process-pid p))))))
(else
- (and-let* ((p (or p (pending-before pid))))
+ (and-let* ((p (or p (and pending-before (pending-before pid)))))
(scsh-process-exit-status-set! p status)
(scsh-process-ok?-set! p ok?)
(condition-variable-broadcast!
diff --git a/tests/run.scm b/tests/run.scm
index b5fa419..1038235 100644
--- a/tests/run.scm
+++ b/tests/run.scm
@@ -5,6 +5,7 @@
(cond-expand
(chicken-5 (import (chicken base) (chicken port) (chicken condition)
(chicken io) (chicken file) (chicken file posix)
+ (prefix (chicken process) core:)
(chicken process signal)
(chicken fixnum) ;; Why is this needed?!
srfi-18 test)
@@ -53,6 +54,17 @@
(receive (status2 ok?2 pid2) (wait p)
(list (eq? status status2) (eq? ok? ok?2) (or (eq? pid pid2) (list pid pid2)))))))
+ (let ((raw-pid (core:process-fork (lambda () (sleep 1)))))
+ (test "after forking via native process-fork, waiting for \"any\" next process still returns the status"
+ (list 0 #t raw-pid)
+ (call-with-values (lambda () (wait #f)) list)))
+
+ ;; Regression test for bug reported by Matt Welland (this broke w/ poule)
+ (let ((raw-pid (core:process-fork (lambda () (sleep 1)))))
+ (test "after forking via native process-fork, waiting for the specific process by pid still returns the status"
+ (list 0 #t raw-pid)
+ (call-with-values (lambda () (wait raw-pid)) list)))
+
(test-assert "signal wasn't unmasked" (signal-masked? signal/chld))
(test "sigchld is masked inside child process"