Skip to content

Commit

Permalink
Auto merge of #1026 - jelford:run_outside_tty, r=Diggsey
Browse files Browse the repository at this point in the history
Better error message when not running in a tty

-t returns true if the provided file descriptor is open and refers
to a terminal.

    jelford@ ~/s/rustup.rs> echo (./rustup-init.sh )
    info: downloading installer
    rustup: Unable to run interactively. Run with -y to accept defaults, --help for additional options

    jelford@ ~/s/rustup.rs> echo (./rustup-init.sh -y)
    info: downloading installer
    info: updating existing rustup installation

Should close #648
  • Loading branch information
bors committed Apr 2, 2017
2 parents af52e4d + b77c047 commit 04597f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rustup-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 04597f5

Please sign in to comment.