mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
build: container: Fix call-with-clean-exit.
Before, call-with-clean-exit would *always* return an exit code of 1. * gnu/build/linux-container.scm (call-with-clean-exit): Exit with status code of 0 if thunk does not throw an exception. * tests/containers.scm: Add test.
This commit is contained in:
parent
f5a21dc4cf
commit
a72ccbc251
2 changed files with 7 additions and 1 deletions
|
@ -36,7 +36,9 @@ (define (call-with-clean-exit thunk)
|
|||
"Apply THUNK, but exit with a status code of 1 if it fails."
|
||||
(dynamic-wind
|
||||
(const #t)
|
||||
thunk
|
||||
(lambda ()
|
||||
(thunk)
|
||||
(primitive-exit 0))
|
||||
(lambda ()
|
||||
(primitive-exit 1))))
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@ (define (assert-exit x)
|
|||
|
||||
(test-begin "containers")
|
||||
|
||||
(test-assert "call-with-container, exit with 0 when there is no error"
|
||||
(zero?
|
||||
(call-with-container '() (const #t) #:namespaces '(user))))
|
||||
|
||||
(test-assert "call-with-container, user namespace"
|
||||
(zero?
|
||||
(call-with-container '()
|
||||
|
|
Loading…
Reference in a new issue