diff options
author | Christopher Baines <mail@cbaines.net> | 2017-01-25 07:24:20 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-01-25 14:27:31 +0100 |
commit | 0ca575f3bbb6de07469d5bf285ff1a8878a74e1e (patch) | |
tree | c18e05075d60ad4a694bd682914ee5df7f10f3b0 /guix/scripts/container | |
parent | e57bd0bed86caac304e5f37c5653e6b13858c7c5 (diff) |
container: Pass through TERM when calling exec.
* guix/scripts/container/exec.scm (guix-container-exec): Capture the value of
the TERM environment variable, and pass it through to the container. This
means some applications now work where they did not before (e.g. htop), and
others have more functionality, providing that the terminal was capable of
enabling that functionality in the first place.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/scripts/container')
-rw-r--r-- | guix/scripts/container/exec.scm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/guix/scripts/container/exec.scm b/guix/scripts/container/exec.scm index 10e70568cc..d6d267daff 100644 --- a/guix/scripts/container/exec.scm +++ b/guix/scripts/container/exec.scm @@ -74,7 +74,14 @@ and the other containing arguments for the command to be executed." (let* ((opts (parse-command-line args %options '(()) #:argument-handler handle-argument)) - (pid (assoc-ref opts 'pid))) + (pid (assoc-ref opts 'pid)) + (environment (filter-map (lambda (name) + (let ((value (getenv name))) + (and value (cons name value)))) + ;; Pass through the TERM environment + ;; variable to inform processes about + ;; the capabilities of the terminal. + '("TERM")))) (unless pid (leave (_ "no pid specified~%"))) @@ -89,6 +96,10 @@ and the other containing arguments for the command to be executed." (lambda () (match command ((program . program-args) + (for-each (match-lambda + ((name . value) + (setenv name value))) + environment) (apply execlp program program program-args))))))) (unless (zero? result) (leave (_ "exec failed with status ~d~%") result))))))) |