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.
This commit is contained in:
Ludovic Courtès 2023-01-29 22:13:53 +01:00
parent 17448c8afa
commit 52eb3db19c
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 15 additions and 6 deletions

View file

@ -404,7 +404,7 @@ load path must be adjusted as needed."
(define (container-excursion pid thunk)
"Run THUNK as a child process within the namespaces of process PID and
return the exit status."
return the exit status, an integer as returned by 'waitpid'."
(define (namespace-file pid namespace)
(string-append "/proc/" (number->string pid) "/ns/" namespace))
@ -436,7 +436,7 @@ return the exit status."
(pid
(match (waitpid pid)
((_ . status)
(status:exit-val status))))))
status)))))
(define (container-excursion* pid thunk)
"Like 'container-excursion', but return the return value of THUNK."