1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-05-18 09:53:22 -07:00

do the private-or-subshell dance for maybesudo

This commit is contained in:
Connor Olding 2024-03-21 14:36:41 -07:00
parent b5c5ebfded
commit bdd25226a8
2 changed files with 5 additions and 4 deletions

View File

@ -4,7 +4,7 @@
# YES_DASH # YES_DASH
# YES_ASH # YES_ASH
maybesudo_() ( ### @- __maybesudo() { ### @maybesudo
### mimic certain features of `sudo` for systems without it installed. ### mimic certain features of `sudo` for systems without it installed.
### as it stands, this mostly just handles some environment variables. ### as it stands, this mostly just handles some environment variables.
### ###
@ -113,6 +113,7 @@ maybesudo_() ( ### @-
fi fi
env "$@" env "$@"
) }
[ -n "${preload+-}" ] || maybesudo_ "$@" maybesudo_()(__maybesudo "$@")
[ -n "${preload+-}" ] || __maybesudo "$@"

View File

@ -7,7 +7,7 @@
pippy() { ### @- pippy() { ### @-
### install Python packages using pip, ### install Python packages using pip,
### but only update their dependencies as required. ### but only update their dependencies as required.
### this uses [`maybesudo`](#maybesudo_-shmaybesudo) internally. ### this uses [`maybesudo`](#maybesudo) internally.
if [ -s ~/work/automamba ]; then if [ -s ~/work/automamba ]; then
~/work/automamba --pip install --upgrade --upgrade-strategy only-if-needed --dry-run "$@" ~/work/automamba --pip install --upgrade --upgrade-strategy only-if-needed --dry-run "$@"
confirm || return confirm || return