1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-22 20:40:29 +02:00

(system): New function, giving an exit code return in

accordance with slib spec.
This commit is contained in:
Kevin Ryde 2004-01-11 00:29:50 +00:00
parent 12819d6108
commit 7599c537f4

View file

@ -232,6 +232,25 @@
(define >? >)
(define >=? >=)
;;; {system}
;;;
;; If the program run is killed by a signal, the shell normally gives an
;; exit code of 128+signum. If the shell itself is killed by a signal then
;; we do the same 128+signum here.
;;
;; "stop-sig" shouldn't arise here, since system shouldn't be calling
;; waitpid with WUNTRACED, but allow for it anyway, just in case.
;;
(if (defined? 'system)
(define-public system
(let ((guile-core-system system))
(lambda (str)
(let ((st (guile-core-system str)))
(or (status:exit-val st)
(+ 128 (or (status:term-sig st)
(status:stop-sig st)))))))))
;;; {Time}
;;;