From b4a635088719de96a0112368fd07047c602f1044 Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Sun, 25 Nov 2018 20:54:31 -0500 Subject: [PATCH] Exit subshells with the current status * geesh/shell.scm (%subshell): Use with-continuation-barrier and primitive-exit to make sure the child process exits with its status. --- geesh/shell.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/geesh/shell.scm b/geesh/shell.scm index 6b54736..2fc7e22 100644 --- a/geesh/shell.scm +++ b/geesh/shell.scm @@ -206,8 +206,11 @@ process." ;; duplicate output. (flush-all-ports) (match (primitive-fork) - (0 (thunk) - (primitive-exit)) + (0 (with-continuation-barrier + (lambda () + (thunk) + (primitive-exit (get-status)))) + (primitive-exit 1)) (pid pid))) (define (sh:subshell thunk)