about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-07-16 15:54:15 -0400
committerSteve Klabnik <steve@steveklabnik.com>2015-07-16 21:35:01 -0400
commit82d0442cea39c89928580894f6196fe7ed89b3f6 (patch)
tree3071e7fd0daa903c4277a0558b7bdc1524c10ceb
parente4e93196e16030ebf7a20c473849534235d676f8 (diff)
downloadrust-82d0442cea39c89928580894f6196fe7ed89b3f6.tar.gz
rust-82d0442cea39c89928580894f6196fe7ed89b3f6.zip
rustdoc: properly capture rustc output
When rustc gives an error, there's a ton of extra output from the panic.
Now, we use monitor() to supress the excess output.

Fixes #27014
-rw-r--r--src/librustdoc/lib.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 9ea22ced927..421dcae19c9 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -132,7 +132,7 @@ pub fn main() {
     let res = std::thread::Builder::new().stack_size(STACK_SIZE).spawn(move || {
         let s = env::args().collect::<Vec<_>>();
         main_args(&s)
-    }).unwrap().join().unwrap();
+    }).unwrap().join().unwrap_or(101);
     process::exit(res as i32);
 }
 
@@ -273,7 +273,6 @@ pub fn main_args(args: &[String]) -> isize {
                                                  !matches.opt_present("markdown-no-toc")),
         (false, false) => {}
     }
-
     let out = match acquire_input(input, externs, &matches) {
         Ok(out) => out,
         Err(s) => {
@@ -375,12 +374,12 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
     info!("starting to run rustc");
 
     let (tx, rx) = channel();
-    std::thread::spawn(move || {
+    rustc_driver::monitor(move || {
         use rustc::session::config::Input;
 
         tx.send(core::run_core(paths, cfgs, externs, Input::File(cr),
                                triple)).unwrap();
-    }).join().map_err(|_| "rustc failed").unwrap();
+    });
     let (mut krate, analysis) = rx.recv().unwrap();
     info!("finished with rustc");
     let mut analysis = Some(analysis);