1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

darwin-rebuild: add comments explaining the custom sudo logic

This commit is contained in:
Michael Hoang 2024-10-22 23:57:13 +11:00
parent 0a686597fa
commit 9ee30f2534

View file

@ -18,7 +18,11 @@ showSyntax() {
}
sudo() {
# REMOVEME when support for macOS 10.13 is dropped
# macOS 10.13 does not support sudo --preserve-env so we make this conditional
if command sudo --help | grep -- --preserve-env= >/dev/null; then
# We use `env` before our command to ensure the preserved PATH gets checked
# when trying to resolve the command to execute
command sudo -H --preserve-env=PATH env "$@"
else
command sudo -H "$@"