summaryrefslogtreecommitdiff
path: root/tests/run.scm
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2017-11-10 21:00:22 +0100
committerPeter Bex <peter@more-magic.net>2017-11-10 21:03:18 +0100
commita29a4e79aa00d697a564cb3bd7f1f78d7e5d7245 (patch)
tree1f0554b1fffb1d7bbcc74e17bd35bc7eaa106c5c /tests/run.scm
parentbac1abe8dda69b9350aa1f983092ca1dfb9062be (diff)
downloadscsh-process-a29a4e79aa00d697a564cb3bd7f1f78d7e5d7245.tar.gz
Don't unmask signal if the signal was already masked before forking
Diffstat (limited to 'tests/run.scm')
-rw-r--r--tests/run.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/run.scm b/tests/run.scm
index 8e202ac..f4409fd 100644
--- a/tests/run.scm
+++ b/tests/run.scm
@@ -17,6 +17,12 @@
(test "run/string* returns a string output in a subprocess"
"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.
+ (signal-mask! signal/chld)
+
(test "wait for next process to exit"
'(#t #t #t)
(let ((p (& (sleep 1))))
@@ -24,6 +30,10 @@
(receive (status2 ok?2 pid2) (wait p)
(list (eq? status status2) (eq? ok? ok?2) (or (eq? pid pid2) (list pid pid2)))))))
+ (test-assert "signal wasn't unmasked" (signal-masked? signal/chld))
+
+ (signal-unmask! signal/chld)
+
;; Reported by Haochi Kiang
(test "run/string* does not redirect stderr"
'("This should go to stdout" "")