diff --git a/script/dot.fish b/script/dot.fish index 031fbda..bde325e 100755 --- a/script/dot.fish +++ b/script/dot.fish @@ -145,6 +145,10 @@ end # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +ask_for_sudo + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # Ensure npm is available. "$DOT/node/volta.fish" diff --git a/script/utils.fish b/script/utils.fish index b857568..d9ae1da 100755 --- a/script/utils.fish +++ b/script/utils.fish @@ -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