summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-01-29 22:13:53 +0100
committerLudovic Courtès <ludo@gnu.org>2023-01-30 22:24:27 +0100
commit52eb3db19cb9e5c294c86a8552a4baaa5b473672 (patch)
treeba94f91ca1d18cb07917ed3a45f43f03c1ac3a85 /guix/scripts
parent17448c8afa507bf26509cbd0a35836f910d0bf3b (diff)
container: Correctly report exit status.
* gnu/build/linux-container.scm (container-excursion): Return the raw status value. * tests/containers.scm ("container-excursion, same namespaces"): Add 'status:exit-val' call. * guix/scripts/container/exec.scm (guix-container-exec): Correctly handle the different cases.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/container/exec.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/guix/scripts/container/exec.scm b/guix/scripts/container/exec.scm
index 51b616b384..3e70b1d3c2 100644
--- a/guix/scripts/container/exec.scm
+++ b/guix/scripts/container/exec.scm
@@ -102,4 +102,12 @@ and the other containing arguments for the command to be executed."
environment)
(apply execlp program program program-args)))))))
(unless (zero? result)
- (leave (G_ "exec failed with status ~d~%") result)))))))
+ (match (status:exit-val result)
+ (#f
+ (if (status:term-sig result)
+ (leave (G_ "process terminated with signal ~a~%")
+ (status:term-sig result))
+ (leave (G_ "process stopped with signal ~a~%")
+ (status:stop-sig result))))
+ (code
+ (leave (G_ "process exited with status ~d~%") code)))))))))