From b77c0474a265c53ecce19ab895309f5df6e943bf Mon Sep 17 00:00:00 2001 From: James Elford Date: Sat, 1 Apr 2017 19:20:09 +0100 Subject: [PATCH] Better error message when not running in a tty -t returns true if the provided file descriptor is open and refers to a terminal. --- rustup-init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index 8aaf3d0720..764f16245d 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -114,8 +114,8 @@ main() { # reading stdin. This script was piped into `sh` though and # doesn't have stdin to pass to its children. Instead we're going # to explicitly connect /dev/tty to the installer's stdin. - if [ ! -e "/dev/tty" ]; then - err "/dev/tty does not exist" + if [ ! -t 1 ]; then + err "Unable to run interactively. Run with -y to accept defaults, --help for additional options" fi run "$_file" "$@" < /dev/tty