From a480c1dc8eb304906dd2355d38393cbb0711f3c3 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 27 Sep 2023 16:50:59 +0530 Subject: [PATCH] refactor: remove usage of async writing to child stdin Co-authored-by: Filip Tibell --- src/lune/builtins/process/mod.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/lune/builtins/process/mod.rs b/src/lune/builtins/process/mod.rs index 8efda59..569e0b9 100644 --- a/src/lune/builtins/process/mod.rs +++ b/src/lune/builtins/process/mod.rs @@ -220,15 +220,10 @@ async fn spawn_command( // If the stdin option was provided, we write that to the child if let Some(stdin) = stdin { let mut child_stdin = child.stdin.take().unwrap(); - - let _ = task::spawn(async move { - let mut tee = AsyncTeeWriter::new(&mut child_stdin); - tee.write_all(stdin.as_bytes()).await.into_lua_err()?; - - Ok::<(), LuaError>(()) - }) - .await - .expect("Tee writer for stdin errored"); + child_stdin + .write_all(stdin.as_bytes()) + .await + .into_lua_err()?; } if inherit_stdio {