Skip to content

Commit

Permalink
conditionally connect /dev/tty only when environment var TTY=1
Browse files Browse the repository at this point in the history
  • Loading branch information
sabine committed Apr 5, 2023
1 parent 950f614 commit 6dd85c2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions shell/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,22 @@ usage() {
echo "using '--fresh' or '--dev'"
}

# Conditionally connect /dev/tty when
# the environment variable TTY is set to 1
if ${TTY+false}; then
TTY=no
fi
R=
prompt() {
# expects to be called as prompt "Do you want to do this? [Y/n]"
# expects to be called as prompt "Do you want to do this? [Y/n] "
printf "$1"
read R </dev/tty
if [ $TTY = 1 ]; then
read R </dev/tty
else
read R
fi
}


RESTORE=
NOBACKUP=
FRESH=
Expand Down

0 comments on commit 6dd85c2

Please sign in to comment.