@@ -412,13 +412,6 @@ fn execute_subcommand(config: &mut Config, cmd: &str, subcommand_args: &ArgMatch
412
412
return exec ( config, subcommand_args) ;
413
413
}
414
414
415
- let mut ext_args: Vec < & OsStr > = vec ! [ OsStr :: new( cmd) ] ;
416
- ext_args. extend (
417
- subcommand_args
418
- . get_many :: < OsString > ( "" )
419
- . unwrap_or_default ( )
420
- . map ( OsString :: as_os_str) ,
421
- ) ;
422
415
if commands:: run:: is_manifest_command ( cmd) {
423
416
let ext_path = super :: find_external_subcommand ( config, cmd) ;
424
417
if !config. cli_unstable ( ) . script && ext_path. is_some ( ) {
@@ -429,11 +422,30 @@ This was previously accepted but will be phased out when `-Zscript` is stabilize
429
422
For more information, see issue #12207 <https://github.com/rust-lang/cargo/issues/12207>." ,
430
423
cmd,
431
424
) ) ?;
425
+ let mut ext_args: Vec < & OsStr > = vec ! [ OsStr :: new( cmd) ] ;
426
+ ext_args. extend (
427
+ subcommand_args
428
+ . get_many :: < OsString > ( "" )
429
+ . unwrap_or_default ( )
430
+ . map ( OsString :: as_os_str) ,
431
+ ) ;
432
432
super :: execute_external_subcommand ( config, cmd, & ext_args)
433
433
} else {
434
+ let ext_args: Vec < OsString > = subcommand_args
435
+ . get_many :: < OsString > ( "" )
436
+ . unwrap_or_default ( )
437
+ . cloned ( )
438
+ . collect ( ) ;
434
439
return commands:: run:: exec_manifest_command ( config, cmd, & ext_args) ;
435
440
}
436
441
} else {
442
+ let mut ext_args: Vec < & OsStr > = vec ! [ OsStr :: new( cmd) ] ;
443
+ ext_args. extend (
444
+ subcommand_args
445
+ . get_many :: < OsString > ( "" )
446
+ . unwrap_or_default ( )
447
+ . map ( OsString :: as_os_str) ,
448
+ ) ;
437
449
super :: execute_external_subcommand ( config, cmd, & ext_args)
438
450
}
439
451
}
0 commit comments