File tree 2 files changed +98
-59
lines changed
2 files changed +98
-59
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: error:: Error ;
2
- use crate :: helpers:: is_command_on_path;
3
2
use crate :: pm_vendor:: * ;
4
3
use serde:: { Deserialize , Serialize } ;
5
4
use std:: fmt;
@@ -122,13 +121,22 @@ impl SystemPackageManager {
122
121
/// Return the command to use for elevated access. On Unix, this will use
123
122
/// "doas" or "sudo", and on Windows or WASM this does nothing.
124
123
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
+
125
129
#[ 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
+ }
132
140
}
133
141
134
142
#[ cfg( any( windows, target_arch = "wasm32" ) ) ]
You can’t perform that action at this time.
0 commit comments