lex_hello worked for a second just now

this is just a backup however
This commit is contained in:
2025-02-02 10:20:03 +01:00
parent 2b79e96dc9
commit 1556d54226
45 changed files with 646 additions and 371 deletions

View File

@@ -1,9 +1,15 @@
use std::pin::pin;
use async_std::io;
use async_once_cell::OnceCell;
use async_std::io::{self, Stdout};
use async_std::sync::Mutex;
use orchid_base::msg::{recv_msg, send_msg};
static STDOUT: OnceCell<Mutex<Stdout>> = OnceCell::new();
pub async fn send_parent_msg(msg: &[u8]) -> io::Result<()> {
send_msg(pin!(io::stdout()), msg).await
let stdout_lk = STDOUT.get_or_init(async { Mutex::new(io::stdout()) }).await;
let mut stdout_g = stdout_lk.lock().await;
send_msg(pin!(&mut *stdout_g), msg).await
}
pub async fn recv_parent_msg() -> io::Result<Vec<u8>> { recv_msg(pin!(io::stdin())).await }