From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Thompson Subject: [PATCH] build: container: Fix call-with-clean-exit. Date: Fri, 09 Oct 2015 16:26:45 -0400 Message-ID: <87a8rrrdoa.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkeFv-00049c-By for guix-devel@gnu.org; Fri, 09 Oct 2015 16:27:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkeFc-0007EA-RZ for guix-devel@gnu.org; Fri, 09 Oct 2015 16:27:07 -0400 Received: from mail.fsf.org ([208.118.235.13]:56480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkeFc-0007Dy-Jt for guix-devel@gnu.org; Fri, 09 Oct 2015 16:26:48 -0400 Received: from [216.236.243.66] (port=59214 helo=izanagi) by mail.fsf.org with esmtpsa (TLS-1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1ZkeFa-0007o4-5H for guix-devel@gnu.org; Fri, 09 Oct 2015 16:26:47 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org --=-=-= Content-Type: text/plain An oversight on my part that I noticed while doing 'guix environment --container' testing. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-build-container-Fix-call-with-clean-exit.patch >From dc72ee831d6c6b93cf404a7fd1abc4b8fb27b7f2 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 9 Oct 2015 12:33:40 -0400 Subject: [PATCH] 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 deletion(-) 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 '() -- 2.5.0 --=-=-= Content-Type: text/plain -- David Thompson GPG Key: 0FF1D807 --=-=-=--