Install handler in CALL-TERMINALLY so scsh with exit with status 1 in case of an error.

This commit is contained in:
mainzelm 2004-03-11 09:54:33 +00:00
parent bcbd16ff0a
commit 622ef7a99f
2 changed files with 10 additions and 4 deletions

View File

@ -232,6 +232,7 @@
general-tables general-tables
simple-syntax simple-syntax
exit-hooks exit-hooks
display-conditions
scsh-endian) scsh-endian)
(for-syntax (open scsh-syntax-helpers scheme)) (for-syntax (open scsh-syntax-helpers scheme))

View File

@ -9,11 +9,16 @@
(define (call-terminally thunk) (define (call-terminally thunk)
(with-continuation (with-continuation
null-continuation null-continuation
(lambda ()
(with-handler
(lambda (c more)
(display-condition c (current-error-port))
(exit 1))
(lambda () (lambda ()
(dynamic-wind (dynamic-wind
(lambda () (values)) (lambda () (values))
thunk thunk
(lambda () (exit 0)))))) (lambda () (exit 0))))))))
;; from shift-reset.scm: ;; from shift-reset.scm:
(define null-continuation #f) (define null-continuation #f)