Skip to content

Commit

Permalink
Merge pull request #2815 from umanwizard/fix_short_opts
Browse files Browse the repository at this point in the history
Detect '-y' short option in rustup-init.sh more robustly
  • Loading branch information
kinnison authored Jul 13, 2021
2 parents 6acf004 + 1089a58 commit 08a317f
Showing 1 changed file with 22 additions and 5 deletions.
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
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

0 comments on commit 08a317f

Please sign in to comment.