Use 'sh:exit' for 'errexit'.
* gash/shell.scm (errexit): Exit using 'sh:exit'. * tests/unit/shell.scm: Make sure exit handlers are called on 'errexit'.
This commit is contained in:
parent
da9a05d500
commit
d9122d7b68
|
@ -55,7 +55,7 @@
|
|||
(define (errexit)
|
||||
(unless (or (zero? (get-status)) (ignore-errexit?))
|
||||
(when (getopt 'errexit)
|
||||
(exit (get-status)))))
|
||||
(sh:exit))))
|
||||
|
||||
(define (install-current-ports!)
|
||||
"Install all current ports into their usual file descriptors. For
|
||||
|
|
|
@ -447,4 +447,20 @@
|
|||
(sh:exec utility)))
|
||||
(call-with-input-file foo get-string-all)))))
|
||||
|
||||
|
||||
;;; Errexit.
|
||||
|
||||
(test-assert "Exit traps are still called on errexit"
|
||||
(call-with-prompt default-prompt-tag
|
||||
(lambda ()
|
||||
(set-atexit! (lambda () (abort-to-prompt default-prompt-tag)))
|
||||
(setopt! 'errexit #t)
|
||||
(call-with-temporary-directory
|
||||
(lambda (directory)
|
||||
(let ((utility (string-append directory "/false")))
|
||||
(make-script utility
|
||||
(exit EXIT_FAILURE))
|
||||
(sh:exec utility)))))
|
||||
(lambda (k) #t)))
|
||||
|
||||
(test-end)
|
||||
|
|
Loading…
Reference in New Issue