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 6799e66
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions shell/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,20 @@ usage() {
echo "using '--fresh' or '--dev'"
}

# Conditionally connect /dev/tty when
# the environment variable TTY is set to 1
TTY=${TTY-0}
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 6799e66

Please sign in to comment.