@@ -178,6 +178,15 @@ pub fn parse_config(args: Vec<String>) -> Config {
178
178
// FIXME: Temporarily retained so we can point users to `--no-capture`
179
179
. optflag ( "" , "nocapture" , "" )
180
180
. optflag ( "" , "no-capture" , "don't capture stdout/stderr of tests" )
181
+ // New-output-capture needs to be `optmulti` so that the value passed
182
+ // by bootstrap can be overridden explicitly if desired
183
+ // (e.g. `x test ui -- --new-output-capture=on`).
184
+ . optmulti (
185
+ "N" ,
186
+ "new-output-capture" ,
187
+ "enables or disables the new output-capture implementation" ,
188
+ "off|on" ,
189
+ )
181
190
. optflag ( "" , "profiler-runtime" , "is the profiler runtime enabled for this target" )
182
191
. optflag ( "h" , "help" , "show this message" )
183
192
. reqopt ( "" , "channel" , "current Rust channel" , "CHANNEL" )
@@ -462,6 +471,16 @@ pub fn parse_config(args: Vec<String>) -> Config {
462
471
supported_crate_types : OnceLock :: new ( ) ,
463
472
464
473
nocapture : matches. opt_present ( "no-capture" ) ,
474
+ new_output_capture : {
475
+ // Ignore all but the last occurrence, so that an explicit override
476
+ // (e.g. `x test ui -- --new-output-capture=on`) takes precedence
477
+ // over whatever was passed by bootstrap.
478
+ let values = matches. opt_strs ( "new-output-capture" ) ;
479
+ // New-output-capture currently defaults to off.
480
+ let value = values. last ( ) . map ( String :: as_str) . unwrap_or ( "off" ) ;
481
+ parse_bool_option ( value)
482
+ . unwrap_or_else ( || panic ! ( "unknown `--new-output-capture` value `{value}` given" ) )
483
+ } ,
465
484
466
485
nightly_branch : matches. opt_str ( "nightly-branch" ) . unwrap ( ) ,
467
486
git_merge_commit_email : matches. opt_str ( "git-merge-commit-email" ) . unwrap ( ) ,
@@ -477,6 +496,14 @@ pub fn parse_config(args: Vec<String>) -> Config {
477
496
}
478
497
}
479
498
499
+ fn parse_bool_option ( value : & str ) -> Option < bool > {
500
+ match value {
501
+ "off" | "no" | "n" | "false" => Some ( false ) ,
502
+ "on" | "yes" | "y" | "true" => Some ( true ) ,
503
+ _ => None ,
504
+ }
505
+ }
506
+
480
507
pub fn opt_str ( maybestr : & Option < String > ) -> & str {
481
508
match * maybestr {
482
509
None => "(none)" ,
0 commit comments