File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -239,9 +239,22 @@ fn xargo_check() -> Command {
239
239
/// Execute the command. If it fails, fail this process with the same exit code.
240
240
/// Otherwise, continue.
241
241
fn exec ( mut cmd : Command ) {
242
- let exit_status = cmd. status ( ) . expect ( "failed to run command" ) ;
243
- if exit_status. success ( ) . not ( ) {
244
- std:: process:: exit ( exit_status. code ( ) . unwrap_or ( -1 ) )
242
+ // On non-Unix imitate POSIX exec as closely as we can
243
+ #[ cfg( not( unix) ) ]
244
+ {
245
+ let exit_status = cmd. status ( ) . expect ( "failed to run command" ) ;
246
+ if exit_status. success ( ) . not ( ) {
247
+ std:: process:: exit ( exit_status. code ( ) . unwrap_or ( -1 ) )
248
+ }
249
+ }
250
+ // On Unix targets, actually exec
251
+ // If exec returns, process setup has failed. This is the same error condition as the expect in
252
+ // the non-Unix case.
253
+ #[ cfg( unix) ]
254
+ {
255
+ use std:: os:: unix:: process:: CommandExt ;
256
+ let error = cmd. exec ( ) ;
257
+ Err ( error) . expect ( "failed to run command" )
245
258
}
246
259
}
247
260
You can’t perform that action at this time.
0 commit comments