Skip to content

Commit 77d12bb

Browse files
authored
Merge pull request #619 from RalfJung/stderr-flush
flush stdout/stderr to make sure it appears on the screen
2 parents b1b9387 + 68e8ff1 commit 77d12bb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/fn_call.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,15 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
390390
use std::io::{self, Write};
391391

392392
let buf_cont = this.memory().read_bytes(buf, Size::from_bytes(n))?;
393+
// We need to flush to make sure this actually appears on the screen
393394
let res = if fd == 1 {
394-
io::stdout().write(buf_cont)
395+
let res = io::stdout().write(buf_cont);
396+
io::stdout().flush().unwrap();
397+
res
395398
} else {
396-
io::stderr().write(buf_cont)
399+
let res = io::stderr().write(buf_cont);
400+
io::stderr().flush().unwrap();
401+
res
397402
};
398403
match res {
399404
Ok(n) => n as i64,

0 commit comments

Comments
 (0)