mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 06:28:20 +03:00
flush stdout/stderr to make sure it appears on the screen
This commit is contained in:
+7
-2
@@ -390,10 +390,15 @@ fn emulate_foreign_item(
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user