Abuse uptime to check if sudo requires password

The ``sudo -n true`` trick doesn't work on OS X.
pull/484/head
jitakirin 2015-05-22 08:43:34 +01:00
parent 9693b39da6
commit 473b3f2075
1 changed files with 1 additions and 1 deletions

View File

@ -38,7 +38,7 @@ function set_rgb_color {
function powerline_shell_prompt { function powerline_shell_prompt {
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR} SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR}
if sudo -n true &>/dev/null; then if sudo -n uptime 2>&1 |grep -q "load"; then
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO} SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO}
fi fi
if [[ -n "${SSH_CLIENT}" ]]; then if [[ -n "${SSH_CLIENT}" ]]; then