env, io,
io::prelude::Write,
panic::{self, catch_unwind, AssertUnwindSafe, PanicInfo},
- process,
- process::{Command, Termination},
+ process::{self, Command, Termination},
sync::mpsc::{channel, Sender},
sync::{Arc, Mutex},
thread,
monitor_ch,
opts.time,
),
- RunStrategy::SpawnPrimary => {
- spawn_test_subprocess(desc, opts.time.is_some(), monitor_ch, opts.time)
- }
+ RunStrategy::SpawnPrimary => spawn_test_subprocess(
+ desc,
+ opts.nocapture,
+ opts.time.is_some(),
+ monitor_ch,
+ opts.time,
+ ),
};
// If the platform is single-threaded we're just going to run
fn spawn_test_subprocess(
desc: TestDesc,
+ nocapture: bool,
report_time: bool,
monitor_ch: Sender<CompletedTest>,
time_opts: Option<time::TestTimeOptions>,
let args = env::args().collect::<Vec<_>>();
let current_exe = &args[0];
+ let mut command = Command::new(current_exe);
+ command.env(SECONDARY_TEST_INVOKER_VAR, desc.name.as_slice());
+ if nocapture {
+ command.stdout(process::Stdio::inherit());
+ command.stderr(process::Stdio::inherit());
+ }
+
let start = report_time.then(Instant::now);
- let output = match Command::new(current_exe)
- .env(SECONDARY_TEST_INVOKER_VAR, desc.name.as_slice())
- .output()
- {
+ let output = match command.output() {
Ok(out) => out,
Err(e) => {
let err = format!("Failed to spawn {} as child for test: {:?}", args[0], e);