feat: proper error handling & error propagation

This commit is contained in:
Erica Marigold 2023-09-18 23:27:48 +05:30
parent ad6b2a2364
commit e1c316f20b

View file

@ -221,12 +221,12 @@ async fn spawn_command(
if let Some(stdin) = stdin { if let Some(stdin) = stdin {
let mut child_stdin = child.stdin.take().unwrap(); let mut child_stdin = child.stdin.take().unwrap();
let stdin_writer_thread = task::spawn(async move { let _ = task::spawn(async move {
let mut tee = AsyncTeeWriter::new(&mut child_stdin); let mut tee = AsyncTeeWriter::new(&mut child_stdin);
tee.write_all(stdin.as_bytes()).await.unwrap(); tee.write_all(stdin.as_bytes()).await.into_lua_err()?;
});
stdin_writer_thread Ok::<(), LuaError>(())
})
.await .await
.expect("Tee writer for stdin errored"); .expect("Tee writer for stdin errored");
} }