File tree 1 file changed +15
-6
lines changed
Filter options
1 file changed +15
-6
lines changed
Original file line number Diff line number Diff line change @@ -413,20 +413,29 @@ fn create_settings(matches: &ArgMatches) -> PySettings {
413
413
settings. warnopts . extend ( warnings. map ( ToOwned :: to_owned) ) ;
414
414
}
415
415
416
- let argv = if let Some ( script) = matches. values_of ( "script" ) {
417
- script. map ( ToOwned :: to_owned) . collect ( )
416
+ // script having values even though -c/-m was passed would means that it was something like -mmodule foo bar
417
+ let weird_script_args = || {
418
+ matches
419
+ . values_of ( "script" )
420
+ . into_iter ( )
421
+ . flat_map ( |script_args| script_args. map ( ToOwned :: to_owned) )
422
+ } ;
423
+ let argv = if let Some ( cmd) = matches. values_of ( "c" ) {
424
+ std:: iter:: once ( "-c" . to_owned ( ) )
425
+ . chain ( cmd. skip ( 1 ) . map ( ToOwned :: to_owned) )
426
+ . chain ( weird_script_args ( ) )
427
+ . collect ( )
418
428
} else if let Some ( module) = matches. values_of ( "m" ) {
419
429
std:: iter:: once ( "PLACEHOLDER" . to_owned ( ) )
420
430
. chain ( module. skip ( 1 ) . map ( ToOwned :: to_owned) )
431
+ . chain ( weird_script_args ( ) )
421
432
. collect ( )
422
433
} else if let Some ( get_pip_args) = matches. values_of ( "install_pip" ) {
423
434
std:: iter:: once ( "get-pip.py" . to_owned ( ) )
424
435
. chain ( get_pip_args. map ( ToOwned :: to_owned) )
425
436
. collect ( )
426
- } else if let Some ( cmd) = matches. values_of ( "c" ) {
427
- std:: iter:: once ( "-c" . to_owned ( ) )
428
- . chain ( cmd. skip ( 1 ) . map ( ToOwned :: to_owned) )
429
- . collect ( )
437
+ } else if let Some ( script) = matches. values_of ( "script" ) {
438
+ script. map ( ToOwned :: to_owned) . collect ( )
430
439
} else {
431
440
vec ! [ "" . to_owned( ) ]
432
441
} ;
You can’t perform that action at this time.
0 commit comments