mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-23 04:50:28 +02:00
(system): New function, giving an exit code return in
accordance with slib spec.
This commit is contained in:
parent
12819d6108
commit
7599c537f4
1 changed files with 19 additions and 0 deletions
|
@ -232,6 +232,25 @@
|
||||||
(define >? >)
|
(define >? >)
|
||||||
(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}
|
;;; {Time}
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue