Abuse uptime to check if sudo requires password
The ``sudo -n true`` trick doesn't work on OS X.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user