Sudo preserve env list argument is --preserve-env (#1276)

Sudo preserve-env

Sudo's preserve env list is `--preserve-env=...` not `--preserve_env=...`.

https://www.man7.org/linux/man-pages/man8/sudo.8.html
This commit is contained in:
Stuart Reilly
2025-08-20 16:33:35 +01:00
committed by GitHub
parent a033152c60
commit 53d08cdf28

View File

@@ -252,7 +252,7 @@ impl Sudo {
},
SudoPreserveEnv::Some(vars) => match self.kind {
SudoKind::Sudo => {
cmd.arg(format!("--preserve_env={}", vars.join(",")));
cmd.arg(format!("--preserve-env={}", vars.join(",")));
}
SudoKind::Run0 => {
for env in vars {