summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/scripts/container/exec.scm16
1 files changed, 12 insertions, 4 deletions
diff --git a/guix/scripts/container/exec.scm b/guix/scripts/container/exec.scm
index b842fd38aa6..10e70568cc6 100644
--- a/guix/scripts/container/exec.scm
+++ b/guix/scripts/container/exec.scm
@@ -50,10 +50,18 @@ Execute COMMMAND within the container process PID.\n"))
50(define (partition-args args) 50(define (partition-args args)
51 "Split ARGS into two lists; one containing the arguments for this program, 51 "Split ARGS into two lists; one containing the arguments for this program,
52and the other containing arguments for the command to be executed." 52and the other containing arguments for the command to be executed."
53 (break (lambda (arg) 53 (define (number-string? str)
54 ;; Split after the pid argument. 54 (false-if-exception (string->number str)))
55 (not (false-if-exception (string->number arg)))) 55
56 args)) 56 (let loop ((a '())
57 (b args))
58 (match b
59 (()
60 (values (reverse a) '()))
61 (((? number-string? head) . tail)
62 (values (reverse (cons head a)) tail))
63 ((head . tail)
64 (loop (cons head a) tail)))))
57 65
58(define (guix-container-exec . args) 66(define (guix-container-exec . args)
59 (define (handle-argument arg result) 67 (define (handle-argument arg result)