summaryrefslogtreecommitdiff
path: root/tests/run.scm
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2017-11-18 13:58:13 +0100
committerPeter Bex <peter@more-magic.net>2017-11-18 13:58:13 +0100
commit1adc1af6d9b52ad33f0b773cfdcd64573a2b7b9e (patch)
tree87af9bb2ce76dbd998da736eeaaff5fdf61aed0b /tests/run.scm
parentdac7e59c6ccd22d36ba4de9c9c6c171c143eb9cc (diff)
downloadscsh-process-1adc1af6d9b52ad33f0b773cfdcd64573a2b7b9e.tar.gz
Run signal handler in a separate thread
This seems to be necessary so that condition-variable-broadcast! works when the signal handler is running in the same thread as the waiting thread.
Diffstat (limited to 'tests/run.scm')
-rw-r--r--tests/run.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/run.scm b/tests/run.scm
index f05d643..7690752 100644
--- a/tests/run.scm
+++ b/tests/run.scm
@@ -18,9 +18,12 @@
"This is a test"
(run/string* (lambda () (display "This is a test"))))
- ;; We must mask sigchld, because otherwise our (wait #f) will fail
- ;; due to scsh-process' signal handler possibly reaping the child
- ;; before our wait is able to do so.
+ ;; Ensure all processes up to here have been reaped
+ (handle-exceptions exn (void) (let lp () (when (wait #f) (lp))))
+
+ ;; We must mask sigchld, because otherwise our next (wait #f) will
+ ;; fail due to scsh-process' signal handler possibly reaping the
+ ;; child before our wait is able to do so.
(signal-mask! signal/chld)
(test "wait for next process to exit"