added stdio::flush so that we can print partial lines using print/eprint

This commit is contained in:
Mark 2023-10-28 14:15:52 +02:00
parent 2c9fb1b4a4
commit 79660c1976

View File

@ -1,4 +1,7 @@
use std::sync::{Arc, Mutex}; use std::{
io::Write,
sync::{Arc, Mutex},
};
use crate::{ use crate::{
data::{self, Data, Type}, data::{self, Data, Type},
@ -48,6 +51,7 @@ impl Config {
out: Arc::new(|a, i| Ok(Type::empty_tuple())), out: Arc::new(|a, i| Ok(Type::empty_tuple())),
run: Arc::new(|a, _i| { run: Arc::new(|a, _i| {
eprint!("{}", a.get()); eprint!("{}", a.get());
std::io::stderr().lock().flush();
Data::empty_tuple() Data::empty_tuple()
}), }),
}), }),
@ -72,6 +76,7 @@ impl Config {
out: Arc::new(|a, i| Ok(Type::empty_tuple())), out: Arc::new(|a, i| Ok(Type::empty_tuple())),
run: Arc::new(|a, _i| { run: Arc::new(|a, _i| {
print!("{}", a.get()); print!("{}", a.get());
std::io::stdout().lock().flush();
Data::empty_tuple() Data::empty_tuple()
}), }),
}), }),