Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
Use SUDO_COMMAND to check for sudo
Browse files Browse the repository at this point in the history
`sudo -n true` only checks that we _could_ use `sudo`, not if we are in
a sudo session.

closes #852
  • Loading branch information
docwhat committed Jul 31, 2018
1 parent 22a7612 commit 7f6ac8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions powerlevel9k.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -623,12 +623,12 @@ prompt_context() {
if [[ $(print -P "%#") == '#' ]]; then
current_state="ROOT"
elif [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then
if sudo -n true 2>/dev/null; then
if [[ -n "$SUDO_COMMAND" ]]; then
current_state="REMOTE_SUDO"
else
current_state="REMOTE"
fi
elif sudo -n true 2>/dev/null; then
elif [[ -n "$SUDO_COMMAND" ]]; then
current_state="SUDO"
fi

Expand Down

0 comments on commit 7f6ac8d

Please sign in to comment.