77//! to reimplement all the rendering logic in this module because of that.
88
99use crate :: builder:: Builder ;
10- use std:: io:: { BufRead , BufReader , Write } ;
10+ use std:: io:: { BufRead , BufReader , Cursor , Write } ;
1111use std:: process:: { ChildStdout , Command , Stdio } ;
1212use std:: time:: Duration ;
1313use yansi_term:: Color ;
@@ -43,6 +43,7 @@ pub(crate) fn try_run_tests(builder: &Builder<'_>, cmd: &mut Command) -> bool {
4343
4444fn run_tests ( builder : & Builder < ' _ > , cmd : & mut Command ) -> bool {
4545 cmd. stdout ( Stdio :: piped ( ) ) ;
46+ cmd. stderr ( Stdio :: piped ( ) ) ;
4647
4748 builder. verbose ( & format ! ( "running: {cmd:?}" ) ) ;
4849
@@ -52,15 +53,20 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut Command) -> bool {
5253 // run this on another thread since the builder is not Sync.
5354 Renderer :: new ( process. stdout . take ( ) . unwrap ( ) , builder) . render_all ( ) ;
5455
55- let result = process. wait ( ) . unwrap ( ) ;
56- if !result. success ( ) && builder. is_verbose ( ) {
56+ let result = process. wait_with_output ( ) . unwrap ( ) ;
57+ if !result. status . success ( ) && builder. is_verbose ( ) {
5758 println ! (
5859 "\n \n command did not execute successfully: {cmd:?}\n \
59- expected success, got: {result}"
60+ expected success, got: {}",
61+ result. status
6062 ) ;
6163 }
6264
63- result. success ( )
65+ // Show the stderr emitted by the test runner at the end. As of 2023-03-02 this is only the
66+ // message at the end of a failed compiletest run.
67+ std:: io:: copy ( & mut Cursor :: new ( & result. stderr ) , & mut std:: io:: stderr ( ) . lock ( ) ) . unwrap ( ) ;
68+
69+ result. status . success ( )
6470}
6571
6672struct Renderer < ' a > {
0 commit comments