mirror of
https://https.git.savannah.gnu.org/git/guix.git/
synced 2025-07-13 02:20:53 +02:00
linux-container: "run-container" scripts shows the container's PID.
* gnu/build/linux-container.scm (call-with-container): Add #:process-spawned-hook and honor it. * gnu/system/linux-container.scm (container-script)[script]: Define 'explain' and pass it as #:process-spawned-hook'.
This commit is contained in:
parent
3d8424a5ad
commit
d236cd16a7
2 changed files with 22 additions and 4 deletions
|
@ -299,8 +299,10 @@ delete it when leaving the dynamic extent of this call."
|
|||
(false-if-exception (delete-file-recursively tmp-dir))))))
|
||||
|
||||
(define* (call-with-container mounts thunk #:key (namespaces %namespaces)
|
||||
(host-uids 1) (guest-uid 0) (guest-gid 0))
|
||||
"Run THUNK in a new container process and return its exit status.
|
||||
(host-uids 1) (guest-uid 0) (guest-gid 0)
|
||||
(process-spawned-hook (const #t)))
|
||||
"Run THUNK in a new container process and return its exit status; call
|
||||
PROCESS-SPAWNED-HOOK with the PID of the new process that has been spawned.
|
||||
MOUNTS is a list of <file-system> objects that specify file systems to mount
|
||||
inside the container. NAMESPACES is a list of symbols corresponding to
|
||||
the identifiers for Linux namespaces: mnt, ipc, uts, pid, user, and net. By
|
||||
|
@ -329,6 +331,7 @@ load path must be adjusted as needed."
|
|||
(false-if-exception
|
||||
(kill pid SIGKILL))))
|
||||
|
||||
(process-spawned-hook pid)
|
||||
(match (waitpid pid)
|
||||
((_ . status) status))))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue