diff options
author | Peter Bex <peter@more-magic.net> | 2025-07-02 14:22:19 +0200 |
---|---|---|
committer | Peter Bex <peter@more-magic.net> | 2025-07-02 14:22:19 +0200 |
commit | 9cb58fc19c41816f33ffe210b39a1f734b4cb7c2 (patch) | |
tree | c427ec4609f0a8e23b494850f58006a840adea44 /tests/run.scm | |
parent | 31ae05553edd6d1c338f0f67d083397935825ca5 (diff) | |
download | scsh-process-9cb58fc19c41816f33ffe210b39a1f734b4cb7c2.tar.gz |
Fix cleanup handling in wait for processes forked without scsh-process1.6.2
The and-let* code assumed that if p was false, it would have a
"pending-before" procedure. Unfortunately, this assumption only holds
when the process would've been forked using "fork" from the
scsh-process egg. If one forked with the "core" fork from CHICKEN
itself, both p and pending-before would be false, which would lead to
a "call of non-procedure: #f" error.
Reported by Matthew Welland.
Diffstat (limited to 'tests/run.scm')
-rw-r--r-- | tests/run.scm | 12 |
1 files changed, 12 insertions, 0 deletions
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" |