@@ -461,19 +461,34 @@ impl Compiler {
461
461
log:: trace!( target: "driver" , "current working directory = {}" , cwd. display( ) ) ;
462
462
463
463
// Determine if a specific output file has been requested
464
- let output_file = match self . output_file {
465
- Some ( path) => Some ( OutputFile :: Real ( path) ) ,
466
- None if self . stdout => Some ( OutputFile :: Stdout ) ,
467
- None => None ,
464
+ std:: dbg!( & self . stdout) ;
465
+ std:: dbg!( & self . output_file) ;
466
+ let output_files = match ( self . output_file , self . stdout ) {
467
+ ( Some ( path) , false ) => Some ( vec ! [ OutputFile :: Real ( path) ] ) ,
468
+ ( None , true ) => Some ( vec ! [ OutputFile :: Stdout ] ) ,
469
+ ( Some ( path) , true ) => Some ( vec ! [ OutputFile :: Real ( path) , OutputFile :: Stdout ] ) ,
470
+ _ => None ,
468
471
} ;
469
472
470
473
// Initialize output types
471
474
let mut output_types = OutputTypes :: new ( self . output_types ) . unwrap_or_else ( |err| err. exit ( ) ) ;
472
475
if output_types. is_empty ( ) {
473
- output_types. insert ( OutputType :: Masp , output_file. clone ( ) ) ;
474
- } else if output_file. is_some ( ) && output_types. get ( & OutputType :: Masp ) . is_some ( ) {
476
+ if let Some ( ref output_file) = output_files {
477
+ for file in output_file {
478
+ output_types. insert ( OutputType :: Masp , Some ( file. clone ( ) ) ) ;
479
+ }
480
+ } else {
481
+ output_types. insert ( OutputType :: Masp , None ) ;
482
+ }
483
+ } else if output_files. is_some ( ) && output_types. get ( & OutputType :: Masp ) . is_some ( ) {
475
484
// The -o flag overrides --emit
476
- output_types. insert ( OutputType :: Masp , output_file. clone ( ) ) ;
485
+ if let Some ( ref output_file) = output_files {
486
+ for file in output_file {
487
+ output_types. insert ( OutputType :: Masp , Some ( file. clone ( ) ) ) ;
488
+ }
489
+ } else {
490
+ output_types. insert ( OutputType :: Masp , None ) ;
491
+ }
477
492
}
478
493
479
494
// Convert --exe or --lib to project type
@@ -518,7 +533,7 @@ impl Compiler {
518
533
Session :: new (
519
534
inputs,
520
535
self . output_dir ,
521
- output_file ,
536
+ output_files ,
522
537
target_dir,
523
538
options,
524
539
emitter,
0 commit comments