From ccd1a8c740a8f65085258ce4596425b226747cbf Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 21 Oct 2013 04:17:36 -0400 Subject: [PATCH] Add keep_alive func --- zsh/lib/util | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zsh/lib/util b/zsh/lib/util index 7213cbe5..a0ed236a 100644 --- a/zsh/lib/util +++ b/zsh/lib/util @@ -19,4 +19,11 @@ function do_link { fi } +# Ask for admin password up front and keep sudo alive until the end of the script +function keep_alive { + sudo -v + while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & +} + + # vim:set ft=zsh: