]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass-valgrind/exit-flushes.rs
Rollup merge of #64235 - mati865:env_logger, r=alexcrichton
[rust.git] / src / test / run-pass-valgrind / exit-flushes.rs
1 // ignore-cloudabi
2 // ignore-emscripten
3 // ignore-sgx no processes
4 // ignore-macos this needs valgrind 3.11 or higher; see
5 // https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679
6
7 use std::env;
8 use std::process::{exit, Command};
9
10 fn main() {
11     if env::args().len() > 1 {
12         print!("hello!");
13         exit(0);
14     } else {
15         let out = Command::new(env::args().next().unwrap()).arg("foo")
16                           .output().unwrap();
17         assert!(out.status.success());
18         assert_eq!(String::from_utf8(out.stdout).unwrap(), "hello!");
19         assert_eq!(String::from_utf8(out.stderr).unwrap(), "");
20     }
21 }