mescc: Exit with non-zero exit code when subprocess fails.
system* returns the result of waitpid. So, suppose that a subprocess fails with exit code 1. Then the waitpid return value will be 256. And exit(256) is equivalent to exit(0). Modified-by: Jan Nieuwenhuizen <janneke@gnu.org> * mes/module/mes/posix.mes (status:exit-val): New function. * module/mescc/mescc.scm (assert-system*): Use it.
This commit is contained in:
parent
cc473c1d72
commit
053309e4dc
|
@ -57,3 +57,6 @@
|
||||||
(define (waitpid pid . options)
|
(define (waitpid pid . options)
|
||||||
(let ((options (if (null? options) 0 (car options))))
|
(let ((options (if (null? options) 0 (car options))))
|
||||||
(core:waitpid pid options)))
|
(core:waitpid pid options)))
|
||||||
|
|
||||||
|
(define (status:exit-val status)
|
||||||
|
(ash status -8))
|
||||||
|
|
|
@ -281,7 +281,7 @@
|
||||||
(let ((status (apply system* args)))
|
(let ((status (apply system* args)))
|
||||||
(when (not (zero? status))
|
(when (not (zero? status))
|
||||||
(stderr "mescc: failed: ~a\n" (string-join args))
|
(stderr "mescc: failed: ~a\n" (string-join args))
|
||||||
(exit status))
|
(exit (status:exit-val status)))
|
||||||
status))
|
status))
|
||||||
|
|
||||||
(define (multi-opt option-name) (lambda (o) (and (eq? (car o) option-name) (cdr o))))
|
(define (multi-opt option-name) (lambda (o) (and (eq? (car o) option-name) (cdr o))))
|
||||||
|
|
Loading…
Reference in a new issue