File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -1967,20 +1967,26 @@ fn unlock_permslip(
1967
1967
key_name : String ,
1968
1968
challenge : UnlockChallenge ,
1969
1969
) -> Result < UnlockResponse > {
1970
+ use std:: env;
1970
1971
use std:: process:: { Command , Stdio } ;
1971
1972
1972
- let mut permslip = Command :: new ( "permslip" )
1973
- . arg ( "sign" )
1974
- . arg ( key_name)
1975
- . arg ( "--sshauth" )
1976
- . arg ( "--kind=tech-port-unlock-challenge" )
1977
- . stdin ( Stdio :: piped ( ) )
1978
- . stdout ( Stdio :: piped ( ) )
1979
- . stderr ( Stdio :: inherit ( ) )
1980
- . spawn ( )
1981
- . context (
1982
- "unable to execute `permslip`, is it in your PATH and executable?" ,
1983
- ) ?;
1973
+ let mut permslip = Command :: new (
1974
+ env:: var ( "PERMSLIP" ) . unwrap_or_else ( |_| String :: from ( "permslip" ) ) ,
1975
+ )
1976
+ . arg ( "sign" )
1977
+ . arg ( key_name)
1978
+ . arg ( "--sshauth" )
1979
+ . arg ( "--kind=tech-port-unlock-challenge" )
1980
+ . stdin ( Stdio :: piped ( ) )
1981
+ . stdout ( Stdio :: piped ( ) )
1982
+ . stderr ( Stdio :: inherit ( ) )
1983
+ . spawn ( )
1984
+ . map_err ( |_| {
1985
+ anyhow ! (
1986
+ "Unable to execute `permslip`, is it in your PATH and executable? \
1987
+ You may also override it with the PERMSLIP environment variable."
1988
+ )
1989
+ } ) ?;
1984
1990
1985
1991
let mut input =
1986
1992
permslip. stdin . take ( ) . context ( "can't get permslip input" ) ?;
You can’t perform that action at this time.
0 commit comments