Revision 14855
Added by Aaron Marcuse-Kubitza about 10 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
489 | 489 |
|
490 | 490 |
function sudo() { self -E "$@"; } |
491 | 491 |
|
492 |
# usage: sudo -u user "${sudo_cmd_wrapper[@]}" "$@"
|
|
493 |
sudo_cmd_wrapper=(env PATH="$PATH") # preserve PATH
|
|
492 |
# usage: sudo -u user $sudo_cmd_wrapper "$@"
|
|
493 |
sudo_cmd_wrapper="$(esc env PATH="$PATH")" # preserve PATH
|
|
494 | 494 |
|
495 | 495 |
func_override sudo__basic |
496 | 496 |
function sudo() # preserves PATH; only runs sudo if needed |
... | ... | |
498 | 498 |
echo_func |
499 | 499 |
if is_callable "$1"; then # using sudo with command |
500 | 500 |
if test "$is_root"; then command "$@" # don't need sudo |
501 |
else sudo__basic "${sudo_cmd_wrapper[@]}" "$@"
|
|
501 |
else sudo__basic $sudo_cmd_wrapper "$@"
|
|
502 | 502 |
fi |
503 | 503 |
else sudo__basic "$@" # using sudo with just options |
504 | 504 |
fi |
Also available in: Unified diff
lib/sh/util.sh: $sudo_cmd_wrapper: use esc() so this does not need to be embedded with [@] array notation