File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -200,8 +200,9 @@ impl Install {
200
200
) ?;
201
201
202
202
if !self . bypass_root_check {
203
+ // use sudo and pass PATH for command like `cargo metadata` to keep working.
203
204
#[ cfg( unix) ]
204
- sudo:: escalate_if_needed ( ) . expect ( "failed to escalate root privileges ." ) ;
205
+ sudo:: with_env ( & [ "PATH" ] ) . expect ( "sudo failed, pass --bypass- root-check to disable ." ) ;
205
206
}
206
207
207
208
let ( mut ext_dir, mut php_ini) = if let Some ( install_dir) = self . install_dir {
@@ -328,8 +329,9 @@ impl Remove {
328
329
use std:: env:: consts;
329
330
330
331
if !self . bypass_root_check {
332
+ // use sudo and pass PATH for command like `cargo metadata` to keep working.
331
333
#[ cfg( unix) ]
332
- sudo:: escalate_if_needed ( ) . expect ( "failed to escalate root privileges ." ) ;
334
+ sudo:: with_env ( & [ "PATH" ] ) . expect ( "sudo failed, pass --bypass- root-check to disable ." ) ;
333
335
}
334
336
335
337
let artifact = find_ext ( self . manifest . as_ref ( ) ) ?;
You can’t perform that action at this time.
0 commit comments