diff --git a/src/binary/mod.rs b/src/binary/mod.rs index a770e20d4e998875d48f6e8bc0104ac8b5b3d366..3bfa1aa0652958560512614cadaf981129c0882f 100644 --- a/src/binary/mod.rs +++ b/src/binary/mod.rs @@ -187,9 +187,6 @@ impl<'a> InteractiveShell<'a> { } None => { print!("{}", context_bis.borrow().history.buffers.iter().format("\n")); - io::stdout().flush().unwrap_or_else(|err| { - eprintln!("ion: history print: {}", err); - }); } } Status::SUCCESS @@ -251,6 +248,12 @@ impl<'a> InteractiveShell<'a> { fn exec<T: Fn(&mut Shell<'_>)>(self, prep_for_exit: &T) -> ! { loop { + io::stdout().flush().unwrap_or_else(|err| { + eprintln!("ion: failed to flush stdio: {}", err); + }); + io::stderr().flush().unwrap_or_else(|err| { + println!("ion: failed to flush stderr: {}", err); + }); let mut lines = std::iter::repeat_with(|| self.readln(prep_for_exit)) .filter_map(|cmd| cmd) .flat_map(|s| s.into_bytes().into_iter().chain(Some(b'\n')));