Do not use 'with-continuation-barrier'.
It turns out that 'with-continuation-barrier' allows delimited continuations (i.e., prompts) to get through. * gash/shell.scm (%subshell): Replace 'with-continuation-barrier' with 'dynamic-wind', making sure to preserve exit statuses that were leaked through before. * tests/unit/shell.scm (call-with-temporary-directory): Replace 'with-continuation-barrier' with 'dynamic-wind'. * tests/spec/oil.scm: Enable previously failing tests.
This commit is contained in:
parent
6228064801
commit
da9a05d500
|
@ -247,13 +247,20 @@ process."
|
||||||
;; duplicate output.
|
;; duplicate output.
|
||||||
(flush-all-ports)
|
(flush-all-ports)
|
||||||
(match (primitive-fork)
|
(match (primitive-fork)
|
||||||
(0 (with-continuation-barrier
|
(0 (dynamic-wind
|
||||||
(lambda ()
|
(lambda () #t)
|
||||||
(restore-signals)
|
(lambda ()
|
||||||
(set-atexit! #f)
|
(restore-signals)
|
||||||
(thunk)
|
(set-atexit! #f)
|
||||||
(primitive-exit (get-status))))
|
;; We need to preserve the status given to 'exit', so we
|
||||||
(primitive-exit 1))
|
;; catch the 'quit' key here.
|
||||||
|
(catch 'quit
|
||||||
|
thunk
|
||||||
|
(lambda (_ status)
|
||||||
|
(primitive-exit status)))
|
||||||
|
(primitive-exit (get-status)))
|
||||||
|
(lambda ()
|
||||||
|
(primitive-exit 1))))
|
||||||
(pid pid)))
|
(pid pid)))
|
||||||
|
|
||||||
(define (sh:subshell thunk)
|
(define (sh:subshell thunk)
|
||||||
|
|
|
@ -158,9 +158,6 @@
|
||||||
("\\$\\(\\(i\\+1\\)\\)" "$(expr $i + 1)"))
|
("\\$\\(\\(i\\+1\\)\\)" "$(expr $i + 1)"))
|
||||||
("while in pipe with subshell"
|
("while in pipe with subshell"
|
||||||
("\\$\\(\\(i\\+1\\)\\)" "$(expr $i + 1)"))
|
("\\$\\(\\(i\\+1\\)\\)" "$(expr $i + 1)"))
|
||||||
;; Gash needs to be fixed to pass these tests.
|
|
||||||
("continue in subshell")
|
|
||||||
("continue in subshell aborts with errexit")
|
|
||||||
;; The Oil shell handles this statically. We
|
;; The Oil shell handles this statically. We
|
||||||
;; will treat it as a fatal run-time error (for
|
;; will treat it as a fatal run-time error (for
|
||||||
;; now).
|
;; now).
|
||||||
|
|
|
@ -58,12 +58,13 @@
|
||||||
(file-system-fold enter? leaf down up skip error #f path))
|
(file-system-fold enter? leaf down up skip error #f path))
|
||||||
|
|
||||||
(define (call-with-temporary-directory proc)
|
(define (call-with-temporary-directory proc)
|
||||||
(let* ((directory (make-temporary-directory))
|
(let* ((directory (make-temporary-directory)))
|
||||||
(result (with-continuation-barrier
|
(dynamic-wind
|
||||||
(lambda ()
|
(lambda () #t)
|
||||||
(proc directory)))))
|
(lambda ()
|
||||||
(delete-recursively directory)
|
(proc directory))
|
||||||
result))
|
(lambda ()
|
||||||
|
(delete-recursively directory)))))
|
||||||
|
|
||||||
(define (%make-script object . forms)
|
(define (%make-script object . forms)
|
||||||
(define (write-script port)
|
(define (write-script port)
|
||||||
|
|
Loading…
Reference in New Issue