diff --git a/packages/lib/src/builtins/stdio.rs b/packages/lib/src/builtins/stdio.rs index 6c517f3..1f69f52 100644 --- a/packages/lib/src/builtins/stdio.rs +++ b/packages/lib/src/builtins/stdio.rs @@ -1,6 +1,7 @@ use blocking::unblock; use dialoguer::{theme::ColorfulTheme, Confirm, Input, MultiSelect, Select}; use mlua::prelude::*; +use std::io::Write; use crate::lua::{ stdio::{ @@ -27,10 +28,12 @@ pub fn create(lua: &'static Lua) -> LuaResult { })? .with_function("write", |_, s: String| { print!("{s}"); + std::io::stdout().flush().expect("Could not flush stdout"); Ok(()) })? .with_function("ewrite", |_, s: String| { eprint!("{s}"); + std::io::stderr().flush().expect("Could not flush stderr"); Ok(()) })? .with_async_function("prompt", |_, options: PromptOptions| {