feat(winget): winget uses sudo when [windows] winget_use_sudo = true (#1061)
Co-authored-by: Gideon <87426140+GideonBear@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
23fff2a09f
commit
85c8bd2277
@@ -47,12 +47,26 @@ pub fn run_winget(ctx: &ExecutionContext) -> Result<()> {
|
||||
.args(["source", "update"])
|
||||
.status_checked()?;
|
||||
|
||||
let mut command = if ctx.config().winget_use_sudo() {
|
||||
match ctx.sudo() {
|
||||
Some(sudo) => {
|
||||
let mut command = ctx.run_type().execute(sudo);
|
||||
command.arg(winget);
|
||||
command
|
||||
}
|
||||
None => ctx.run_type().execute(winget),
|
||||
}
|
||||
} else {
|
||||
ctx.run_type().execute(winget)
|
||||
};
|
||||
|
||||
let mut args = vec!["upgrade", "--all"];
|
||||
if ctx.config().winget_silent_install() {
|
||||
args.push("--silent");
|
||||
}
|
||||
|
||||
ctx.run_type().execute(&winget).args(args).status_checked()?;
|
||||
command.args(args).status_checked()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user