diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2019-09-12 23:06:12 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2019-09-12 23:07:43 +0200 |
| commit | d236cd16a7173278ca69578d3e7ce4d1ce55e04c (patch) | |
| tree | 80a8004b1d383e087745fdc8ecf231d3d370e0a5 /gnu/build | |
| parent | 3d8424a5ad96452ae2bfd98d970f6047cc17b5fa (diff) | |
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'.
Diffstat (limited to 'gnu/build')
| -rw-r--r-- | gnu/build/linux-container.scm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm index 6ccb9248614..87695c98fdd 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." | |||
| 299 | (false-if-exception (delete-file-recursively tmp-dir)))))) | 299 | (false-if-exception (delete-file-recursively tmp-dir)))))) |
| 300 | 300 | ||
| 301 | (define* (call-with-container mounts thunk #:key (namespaces %namespaces) | 301 | (define* (call-with-container mounts thunk #:key (namespaces %namespaces) |
| 302 | (host-uids 1) (guest-uid 0) (guest-gid 0)) | 302 | (host-uids 1) (guest-uid 0) (guest-gid 0) |
| 303 | "Run THUNK in a new container process and return its exit status. | 303 | (process-spawned-hook (const #t))) |
| 304 | "Run THUNK in a new container process and return its exit status; call | ||
| 305 | PROCESS-SPAWNED-HOOK with the PID of the new process that has been spawned. | ||
| 304 | MOUNTS is a list of <file-system> objects that specify file systems to mount | 306 | MOUNTS is a list of <file-system> objects that specify file systems to mount |
| 305 | inside the container. NAMESPACES is a list of symbols corresponding to | 307 | inside the container. NAMESPACES is a list of symbols corresponding to |
| 306 | the identifiers for Linux namespaces: mnt, ipc, uts, pid, user, and net. By | 308 | the identifiers for Linux namespaces: mnt, ipc, uts, pid, user, and net. By |
| @@ -329,6 +331,7 @@ load path must be adjusted as needed." | |||
| 329 | (false-if-exception | 331 | (false-if-exception |
| 330 | (kill pid SIGKILL)))) | 332 | (kill pid SIGKILL)))) |
| 331 | 333 | ||
| 334 | (process-spawned-hook pid) | ||
| 332 | (match (waitpid pid) | 335 | (match (waitpid pid) |
| 333 | ((_ . status) status)))))) | 336 | ((_ . status) status)))))) |
| 334 | 337 | ||
