File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
nexus/tests/integration_tests Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -482,8 +482,20 @@ fn record_operation(whichtest: WhichTest<'_>) {
482
482
// codes.
483
483
let t = term:: stdout ( ) ;
484
484
if let Some ( mut term) = t {
485
+ // We just want to write one green character to stdout. But we also
486
+ // want it to be captured by the test runner like people usually expect
487
+ // when they haven't passed "--nocapture". The test runner only
488
+ // captures output from the `print!` family of macros, not all writes to
489
+ // stdout. So we write the formatting control character, flush that (to
490
+ // make sure it gets emitted before our character), use print for our
491
+ // character, reset the terminal, then flush that.
492
+ //
493
+ // Note that this likely still writes the color-changing control
494
+ // characters to the real stdout, even without "--nocapture". That
495
+ // sucks, but at least you don't see them.
485
496
term. fg ( term:: color:: GREEN ) . unwrap ( ) ;
486
- write ! ( term, "{}" , c) . unwrap ( ) ;
497
+ term. flush ( ) . unwrap ( ) ;
498
+ print ! ( "{}" , c) ;
487
499
term. reset ( ) . unwrap ( ) ;
488
500
term. flush ( ) . unwrap ( ) ;
489
501
} else {
You can’t perform that action at this time.
0 commit comments