File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ pub struct ExecCmd {
2121 pub dir : Option < String > ,
2222
2323 /// The command to execute.
24- pub cmd : String ,
24+ pub cmd_argv0 : Option < String > ,
2525
2626 /// The arguments to the command, if any.
2727 #[ arg( last = true ) ]
Original file line number Diff line number Diff line change @@ -14,7 +14,13 @@ pub fn run(cmd: ExecCmd) -> Result<(), Error> {
1414 hook:: mutate_own_env ( & shadowenv) ?;
1515 }
1616
17- let argv = iter:: once ( cmd. cmd ) . chain ( cmd. cmd_argv ) . collect :: < Vec < _ > > ( ) ;
17+ let argv = if let Some ( argv0) = cmd. cmd_argv0 {
18+ iter:: once ( argv0) . chain ( cmd. cmd_argv ) . collect :: < Vec < _ > > ( )
19+ } else if !cmd. cmd_argv . is_empty ( ) {
20+ cmd. cmd_argv
21+ } else {
22+ return Err ( anyhow:: anyhow!( "no command provided" ) ) ;
23+ } ;
1824
1925 // exec only returns if it was unable to start the new process, and it's always an error.
2026 let err = exec:: Command :: new ( & argv[ 0 ] ) . args ( & argv[ 1 ..] ) . exec ( ) ;
You can’t perform that action at this time.
0 commit comments