aboutsummaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-02-04 18:10:14 +0100
committerLudovic Courtès <ludo@gnu.org>2017-02-06 10:51:25 +0100
commit168aba297866295d96779239e9662821ce9e66ae (patch)
treef9776c08e8c29be68e11baf0716a963b752014c4 /gnu/build
parente69dc545594d9a16de2c6cff4f41598cc3600d3c (diff)
downloadpatches-168aba297866295d96779239e9662821ce9e66ae.tar
patches-168aba297866295d96779239e9662821ce9e66ae.tar.gz
linux-container: Do not rely on 'isatty?'.
This avoids problems where 'isatty?' return #t but 'ttyname' fails with ENOTTY or such. * gnu/build/linux-container.scm (mount-file-systems): Remove call of 'isatty?'. Directly call 'ttyname' and catch 'system-error'.
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/linux-container.scm16
1 files changed, 11 insertions, 5 deletions
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index b71d6a5f88..cd71239527 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -128,13 +128,19 @@ for the process."
"/dev/fuse"))
;; Setup the container's /dev/console by bind mounting the pseudo-terminal
- ;; associated with standard input.
- (let ((in (current-input-port))
- (console (scope "/dev/console")))
- (when (isatty? in)
+ ;; associated with standard input when there is one.
+ (let* ((in (current-input-port))
+ (tty (catch 'system-error
+ (lambda ()
+ ;; This call throws if IN does not correspond to a tty.
+ ;; This is more reliable than 'isatty?'.
+ (ttyname in))
+ (const #f)))
+ (console (scope "/dev/console")))
+ (when tty
(touch console)
(chmod console #o600)
- (bind-mount (ttyname in) console)))
+ (bind-mount tty console)))
;; Setup standard input/output/error.
(symlink "/proc/self/fd" (scope "/dev/fd"))