diff options
author | Christopher Baines <mail@cbaines.net> | 2020-11-29 14:19:55 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-11-29 17:34:18 +0000 |
commit | ff01206345e2306cc633db48e0b29eab9077091a (patch) | |
tree | 25c7ee17005dadc9bf4fae3f0873e03a4704f782 /gnu/build/shepherd.scm | |
parent | ed2545f0fa0e2ad99d5a0c45f532c539b299b9fb (diff) | |
parent | 7c2e67400ffaef8eb6f30ef7126c976ee3d7e36c (diff) |
Merge remote-tracking branch 'origin/master' into core-updates
Diffstat (limited to 'gnu/build/shepherd.scm')
-rw-r--r-- | gnu/build/shepherd.scm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gnu/build/shepherd.scm b/gnu/build/shepherd.scm index 91646288d5..d7b858dea4 100644 --- a/gnu/build/shepherd.scm +++ b/gnu/build/shepherd.scm @@ -21,7 +21,6 @@ #:use-module (gnu system file-systems) #:use-module (gnu build linux-container) #:use-module (guix build utils) - #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match) @@ -199,11 +198,24 @@ namespace, in addition to essential bind-mounts such /proc." "This is a variant of 'fork+exec-command' procedure, that joins the namespaces of process PID beforehand. If there is no support for containers, on Hurd systems for instance, fallback to direct forking." + (define (strip-pid args) + ;; TODO: Replace with 'strip-keyword-arguments' when that no longer pulls + ;; in (guix config). + (let loop ((args args) + (result '())) + (match args + (() + (reverse result)) + ((#:pid _ . rest) + (loop rest result)) + ((head . rest) + (loop rest (cons head result)))))) + (let ((container-support? (file-exists? "/proc/self/ns")) (fork-proc (lambda () (apply fork+exec-command command - (strip-keyword-arguments '(#:pid) args))))) + (strip-pid args))))) (if container-support? (container-excursion* pid fork-proc) (fork-proc)))) |