@@ -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 ( ) {
@@ -428,11 +421,30 @@ external subcommand `{cmd}` has the appearance of a manfiest-command
428
421
This was previously accepted but will be phased out when `-Zscript` is stabilized.
429
422
For more information, see issue #12207 <https://github.com/rust-lang/cargo/issues/12207>." ,
430
423
) ) ?;
424
+ let mut ext_args = vec ! [ OsStr :: new( cmd) ] ;
425
+ ext_args. extend (
426
+ subcommand_args
427
+ . get_many :: < OsString > ( "" )
428
+ . unwrap_or_default ( )
429
+ . map ( OsString :: as_os_str) ,
430
+ ) ;
431
431
super :: execute_external_subcommand ( config, cmd, & ext_args)
432
432
} else {
433
+ let ext_args: Vec < OsString > = subcommand_args
434
+ . get_many :: < OsString > ( "" )
435
+ . unwrap_or_default ( )
436
+ . cloned ( )
437
+ . collect ( ) ;
433
438
commands:: run:: exec_manifest_command ( config, cmd, & ext_args)
434
439
}
435
440
} else {
441
+ let mut ext_args = vec ! [ OsStr :: new( cmd) ] ;
442
+ ext_args. extend (
443
+ subcommand_args
444
+ . get_many :: < OsString > ( "" )
445
+ . unwrap_or_default ( )
446
+ . map ( OsString :: as_os_str) ,
447
+ ) ;
436
448
super :: execute_external_subcommand ( config, cmd, & ext_args)
437
449
}
438
450
}
0 commit comments