File tree Expand file tree Collapse file tree 1 file changed +20
-12
lines changed
src/linux/Packaging.Linux Expand file tree Collapse file tree 1 file changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -40,18 +40,26 @@ if [ -z $is_ci ]; then
4040
4141Git Credential Manager is licensed under the MIT License: https://aka.ms/gcm/license"
4242
43- while true ; do
44- read -p " Do you want to continue? [Y/n] " yn
45- case $yn in
46- [Yy]* |" " )
47- break
48- ;;
49- [Nn]* )
50- exit
51- ;;
52- * )
53- echo " Please answer yes or no."
54- ;;
43+ while true ; do
44+ # Display prompt once before reading input
45+ printf " Do you want to continue? [Y/n] "
46+
47+ # Prefer reading from the controlling terminal (TTY) when available,
48+ # so that input works even if the script is piped (e.g. curl URL | sh)
49+ if [ -r /dev/tty ]; then
50+ read yn < /dev/tty
51+ # If no TTY is available, attempt to read from standard input (stdin)
52+ elif ! read yn; then
53+ # If input is not possible via TTY or stdin, assume a non-interactive environment
54+ # and abort with guidance for automated usage
55+ echo " Interactive prompt unavailable in this environment. Use 'sh -s -- -y' for automated install."
56+ exit 1
57+ fi
58+
59+ case " $yn " in
60+ [Yy]* |" " ) break ;;
61+ [Nn]* ) exit ;;
62+ * ) echo " Please answer yes or no." ;;
5563 esac
5664 done
5765fi
You can’t perform that action at this time.
0 commit comments