Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions src/linux/Packaging.Linux/install-from-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,26 @@ if [ -z $is_ci ]; then

Git Credential Manager is licensed under the MIT License: https://aka.ms/gcm/license"

while true; do
read -p "Do you want to continue? [Y/n] " yn
case $yn in
[Yy]*|"")
break
;;
[Nn]*)
exit
;;
*)
echo "Please answer yes or no."
;;
while true; do
# Display prompt once before reading input
printf "Do you want to continue? [Y/n] "

# Prefer reading from the controlling terminal (TTY) when available,
# so that input works even if the script is piped (e.g. curl URL | sh)
if [ -r /dev/tty ]; then
read yn < /dev/tty
# If no TTY is available, attempt to read from standard input (stdin)
elif ! read yn; then
# If input is not possible via TTY or stdin, assume a non-interactive environment
# and abort with guidance for automated usage
echo "Interactive prompt unavailable in this environment. Use 'sh -s -- -y' for automated install."
exit 1
fi

case "$yn" in
[Yy]*|"") break ;;
[Nn]*) exit ;;
*) echo "Please answer yes or no." ;;
esac
done
fi
Expand Down
Loading