Skip to content

Commit 916fdce

Browse files
committed
Fix sudo brew.
1 parent 721a6e1 commit 916fdce

File tree

2 files changed

+98
-59
lines changed

2 files changed

+98
-59
lines changed

crates/system-env/src/pm.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::error::Error;
2-
use crate::helpers::is_command_on_path;
32
use crate::pm_vendor::*;
43
use serde::{Deserialize, Serialize};
54
use std::fmt;
@@ -122,13 +121,22 @@ impl SystemPackageManager {
122121
/// Return the command to use for elevated access. On Unix, this will use
123122
/// "doas" or "sudo", and on Windows or WASM this does nothing.
124123
pub fn get_elevated_command(&self) -> Option<&str> {
124+
// Does not support sudo!
125+
if matches!(self, Self::Brew | Self::All) {
126+
return None;
127+
}
128+
125129
#[cfg(unix)]
126-
if is_command_on_path("doas") {
127-
Some("doas")
128-
} else if is_command_on_path("sudo") {
129-
Some("sudo")
130-
} else {
131-
None
130+
{
131+
use crate::is_command_on_path;
132+
133+
if is_command_on_path("doas") {
134+
Some("doas")
135+
} else if is_command_on_path("sudo") {
136+
Some("sudo")
137+
} else {
138+
None
139+
}
132140
}
133141

134142
#[cfg(any(windows, target_arch = "wasm32"))]

0 commit comments

Comments
 (0)