mirror of
https://github.com/CompeyDev/lune-packaging.git
synced 2025-01-09 12:19:09 +00:00
Flush buffer on write and ewrite (#47)
This commit is contained in:
parent
d2ed3bdd5d
commit
2931aa690c
1 changed files with 3 additions and 0 deletions
|
@ -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<LuaTable> {
|
|||
})?
|
||||
.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| {
|
||||
|
|
Loading…
Reference in a new issue