guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: build: container: Fix call-with-clean-exit.


From: David Thompson
Subject: 01/01: build: container: Fix call-with-clean-exit.
Date: Sat, 10 Oct 2015 13:01:37 +0000

davexunit pushed a commit to branch master
in repository guix.

commit a72ccbc25125d0d14cabdc1b0f824f27bb64478b
Author: David Thompson <address@hidden>
Date:   Fri Oct 9 12:33:40 2015 -0400

    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.
---
 gnu/build/linux-container.scm |    4 +++-
 tests/containers.scm          |    4 ++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 95220d0..e911494 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -36,7 +36,9 @@
   "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))))
 
diff --git a/tests/containers.scm b/tests/containers.scm
index 4783f8e..0ba8149 100644
--- a/tests/containers.scm
+++ b/tests/containers.scm
@@ -34,6 +34,10 @@
 
 (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 '()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]