Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect '-y' short option in rustup-init.sh more robustly #2815

Merged
merged 1 commit into from
Jul 13, 2021
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
27 changes: 22 additions & 5 deletions rustup-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,32 @@ main() {
local need_tty=yes
for arg in "$@"; do
case "$arg" in
-h|--help)
--help)
usage
exit 0
;;
-y)
# user wants to skip the prompt -- we don't need /dev/tty
need_tty=no
;;
*)
OPTIND=1
if [ "${arg%%--*}" = "" ]; then
# Long option (other than --help);
# don't attempt to interpret it.
continue
fi
while getopts :hy sub_arg "$arg"; do
kinnison marked this conversation as resolved.
Show resolved Hide resolved
case "$sub_arg" in
h)
usage
exit 0
;;
y)
# user wants to skip the prompt --
# we don't need /dev/tty
need_tty=no
;;
*)
;;
esac
done
;;
esac
done
Expand Down