aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorChristian Höltje <docwhat@gerf.org>2018-07-31 23:22:26 +0300
committerChristian Höltje <docwhat@gerf.org>2018-07-31 23:22:26 +0300
commit7f6ac8dbaca1ff1139a1eb2bef1f234cf4a72099 (patch)
treebeb13edb0519b1bd142d7df579da62b6cb039972 /powerlevel9k.zsh-theme
parent22a761208d24027a26daa947a7b4034365fefc16 (diff)
Use SUDO_COMMAND to check for sudo
`sudo -n true` only checks that we _could_ use `sudo`, not if we are in a sudo session. closes #852
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme4
1 files changed, 2 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 3e425c48..0b9dc708 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -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