From d236cd16a7173278ca69578d3e7ce4d1ce55e04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 12 Sep 2019 23:06:12 +0200 Subject: 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'. --- gnu/build/linux-container.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gnu/build') diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm index 6ccb924861..87695c98fd 100644 --- a/gnu/build/linux-container.scm +++ b/gnu/build/linux-container.scm @@ -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 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)))))) -- cgit v1.2.3