76ffd9e22acc7f11ca501f03d6999adbdb9baa61

Author
Marc Cornellà <marc@mcornella.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(installer): handle sudo shims that don't support -k flag (#13651)

Related to #13585

Co-authored-by: Daniel Bates <daniel@batesai.org>

Diff

 1diff --git a/tools/install.sh b/tools/install.sh
 2index c31ce2d552e47fbdda666d01ccf13bb6a3e5fea2..d907b795ca316c2a9b34ae58d3c820dcc2d0714a 100755
 3--- a/tools/install.sh
 4+++ b/tools/install.sh
 5@@ -473,7 +473,8 @@ EOF
 6   # be prompted for the password either way, so this shouldn't cause any issues.
 7   #
 8   if user_can_sudo; then
 9-    sudo -k chsh -s "$zsh" "$USER"  # -k forces the password prompt
10+    sudo -k >/dev/null 2>&1         # -k forces the password prompt
11+    sudo chsh -s "$zsh" "$USER"
12   else
13     chsh -s "$zsh" "$USER"          # run chsh normally
14   fi