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:
Timothy Sample 2019-06-07 20:13:17 -04:00
parent 6228064801
commit da9a05d500
3 changed files with 21 additions and 16 deletions

View File

@ -247,13 +247,20 @@ process."
;; duplicate output.
(flush-all-ports)
(match (primitive-fork)
(0 (with-continuation-barrier
(lambda ()
(restore-signals)
(set-atexit! #f)
(thunk)
(primitive-exit (get-status))))
(primitive-exit 1))
(0 (dynamic-wind
(lambda () #t)
(lambda ()
(restore-signals)
(set-atexit! #f)
;; We need to preserve the status given to 'exit', so we
;; catch the 'quit' key here.
(catch 'quit
thunk
(lambda (_ status)
(primitive-exit status)))
(primitive-exit (get-status)))
(lambda ()
(primitive-exit 1))))
(pid pid)))
(define (sh:subshell thunk)

View File

@ -158,9 +158,6 @@
("\\$\\(\\(i\\+1\\)\\)" "$(expr $i + 1)"))
("while in pipe with subshell"
("\\$\\(\\(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
;; will treat it as a fatal run-time error (for
;; now).

View File

@ -58,12 +58,13 @@
(file-system-fold enter? leaf down up skip error #f path))
(define (call-with-temporary-directory proc)
(let* ((directory (make-temporary-directory))
(result (with-continuation-barrier
(lambda ()
(proc directory)))))
(delete-recursively directory)
result))
(let* ((directory (make-temporary-directory)))
(dynamic-wind
(lambda () #t)
(lambda ()
(proc directory))
(lambda ()
(delete-recursively directory)))))
(define (%make-script object . forms)
(define (write-script port)