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.
This commit is contained in:
Timothy Sample 2018-11-25 20:54:31 -05:00
parent 77f3113fd0
commit b4a6350887
1 changed files with 5 additions and 2 deletions

View File

@ -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)