File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,13 @@ impl Command {
8383 Exec :: cmd ( "sudo" )
8484 } ;
8585
86+ // use SUDO_ASKPASS program for sudo if present
87+ let cmd = if std:: env:: var ( "SUDO_ASKPASS" ) . is_ok ( ) {
88+ cmd. arg ( "-A" )
89+ } else {
90+ cmd
91+ } ;
92+
8693 cmd. arg ( & self . command ) . args ( & self . args )
8794 } else {
8895 Exec :: cmd ( & self . command ) . args ( & self . args )
Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ fn self_elevate() -> ! {
4545 use std:: os:: unix:: process:: CommandExt ;
4646
4747 let mut cmd = std:: process:: Command :: new ( "sudo" ) ;
48+ // use SUDO_ASKPASS program for sudo if present
49+ if std:: env:: var ( "SUDO_ASKPASS" ) . is_ok ( ) {
50+ cmd. arg ( "-A" ) ;
51+ }
52+
4853 cmd. args ( std:: env:: args ( ) ) ;
4954 debug ! ( "{:?}" , cmd) ;
5055 let err = cmd. exec ( ) ;
You can’t perform that action at this time.
0 commit comments