about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-11-07 13:10:29 -0500
committerJoshua Nelson <jyn514@gmail.com>2020-11-14 02:48:13 -0500
commite6e4a0ab63edb18d28e7de57b10e80f95ffd7666 (patch)
treefa99a6114fd2b6a64a12957a8c7fe0ea897bd326
parent619880e5546d7a0a5b33ee22b972e4acd6bbcf37 (diff)
downloadrust-e6e4a0ab63edb18d28e7de57b10e80f95ffd7666.tar.gz
rust-e6e4a0ab63edb18d28e7de57b10e80f95ffd7666.zip
Capture stdout and stderr of diff so they'll be printed at the end
-rw-r--r--src/tools/compiletest/src/runtest.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 6eb7edf85aa..7e17cac8b83 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2382,7 +2382,7 @@ impl<'test> TestCx<'test> {
             AllowUnused::Yes,
         );
         rustc.arg("-L").arg(&new_rustdoc.aux_output_dir_name());
-        new_rustdoc.build_all_auxiliary(&mut dbg!(rustc));
+        new_rustdoc.build_all_auxiliary(&mut rustc);
 
         let proc_res = new_rustdoc.document(&compare_dir);
         if !proc_res.status.success() {
@@ -2414,19 +2414,25 @@ impl<'test> TestCx<'test> {
         let mut diff = Command::new("diff");
         diff.args(&["-u", "-r"]).args(&[out_dir, &compare_dir]);
 
-        if has_delta {
+        let output = if has_delta {
             let diff_pid = diff.stdout(Stdio::piped()).spawn().expect("failed to run `diff`");
-            let status = Command::new("delta")
+            let output = Command::new("delta")
                 .arg("--paging=never")
                 .stdin(diff_pid.stdout.unwrap())
-                .status()
+                // Capture output and print it explicitly so it will in turn be
+                // captured by libtest.
+                .output()
                 .unwrap();
-            assert!(status.success());
+            assert!(output.status.success());
+            output
         } else {
             eprintln!("warning: `delta` not installed, falling back to `diff --color`");
-            diff.arg("--color").spawn().expect("failed to run `diff`").wait().unwrap();
-            assert!(status.success() || status.code() == Some(1));
-        }
+            let output = diff.arg("--color").output().unwrap();
+            assert!(output.status.success() || output.status.code() == Some(1));
+            output
+        };
+        println!("{}", String::from_utf8_lossy(&output.stdout));
+        eprintln!("{}", String::from_utf8_lossy(&output.stderr));
     }
 
     fn get_lines<P: AsRef<Path>>(