From 68e8ff1a097fa561a19eeb5d1f0328b8ef20cef4 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 7 Feb 2019 18:04:54 +0100 Subject: [PATCH] flush stdout/stderr to make sure it appears on the screen --- src/fn_call.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fn_call.rs b/src/fn_call.rs index abb239ad7d62..56cb38645090 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -390,10 +390,15 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a, use std::io::{self, Write}; let buf_cont = this.memory().read_bytes(buf, Size::from_bytes(n))?; + // We need to flush to make sure this actually appears on the screen let res = if fd == 1 { - io::stdout().write(buf_cont) + let res = io::stdout().write(buf_cont); + io::stdout().flush().unwrap(); + res } else { - io::stderr().write(buf_cont) + let res = io::stderr().write(buf_cont); + io::stderr().flush().unwrap(); + res }; match res { Ok(n) => n as i64,