Ask for sudo in dot.fish

This commit is contained in:
Marley Rae 2024-02-04 12:49:24 -08:00
parent 715d0ddfed
commit 7c548e23e2
2 changed files with 20 additions and 0 deletions

View file

@ -145,6 +145,10 @@ end
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ask_for_sudo
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Ensure npm is available.
"$DOT/node/volta.fish"

View file

@ -156,3 +156,19 @@ end
function cmd_exists -a cmd
command -v "$cmd" &>/dev/null
end
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function ask_for_sudo
sudo -v &>/dev/null
# Update existing 'sudo' timestamp until this script has finished.
#
# https://gist.github.com/cowboy/3118588
while true
sudo -n true
sleep 60
kill -0 "$fish_pid" || exit
end &>/dev/null &
end