From 6785fa1fc13bcdcaf0bc61d4ee4e0454cba8b154 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Fri, 2 May 2025 09:18:05 +0200 Subject: Return 0 from original process-wait if the process is still running --- scsh-process.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scsh-process.scm') diff --git a/scsh-process.scm b/scsh-process.scm index af3586e..b3f7fd1 100644 --- a/scsh-process.scm +++ b/scsh-process.scm @@ -124,7 +124,11 @@ (let ((posix-process-wait process-wait)) (set! process-wait (lambda (#!optional pid nohang) - (receive (status ok? pid) (wait pid nohang) (values pid ok? status)))) + (receive (status ok? pid) (wait pid nohang) + ;; NOTE: If nohang is true, if the pid returned by + ;; posix-process-wait is zero, our implementation will + ;; return #f. This emulates the original behaviour: + (values (or pid 0) ok? status)))) (set! wait (lambda (#!optional pid-or-process nohang) -- cgit v1.2.3