shims: fs: silence stderr instead of stdout.

Fixes #2143
This commit is contained in:
Matthias Krüger 2022-05-22 21:54:00 +02:00
parent d7d7a9a162
commit 89da571b5d
2 changed files with 5 additions and 4 deletions

View File

@ -307,14 +307,14 @@ pub struct FileHandler {
impl<'tcx> FileHandler {
pub(crate) fn new(mute_stdout_stderr: bool) -> FileHandler {
let mut handles: BTreeMap<_, Box<dyn FileDescriptor>> = BTreeMap::new();
handles.insert(0i32, Box::new(io::stdin()));
if mute_stdout_stderr {
handles.insert(0i32, Box::new(DummyOutput));
handles.insert(1i32, Box::new(DummyOutput));
handles.insert(2i32, Box::new(DummyOutput));
} else {
handles.insert(0i32, Box::new(io::stdin()));
handles.insert(1i32, Box::new(io::stdout()));
handles.insert(2i32, Box::new(io::stderr()));
}
handles.insert(2i32, Box::new(io::stderr()));
FileHandler { handles }
}

View File

@ -1,5 +1,6 @@
// compile-flags: -Zmiri-mute-stdout-stderr
fn main() {
println!("cake");
println!("print to stdout");
eprintln!("print to stderr");
}