From 07ed5629fff12ccb95216f7b07c91bb6e8bbfbc7 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 26 Feb 2022 15:44:13 -0500 Subject: remove the mutex for builtin fds --- src/runner/mod.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/runner/mod.rs') diff --git a/src/runner/mod.rs b/src/runner/mod.rs index d06b332..acdb127 100644 --- a/src/runner/mod.rs +++ b/src/runner/mod.rs @@ -252,7 +252,7 @@ async fn run_pipeline( let pipeline = pipeline.eval(env).await?; let interactive = shell_write.is_some(); let (children, pg) = spawn_children(pipeline, env, &io, interactive)?; - let status = wait_children(children, pg, env, &io, shell_write).await; + let status = wait_children(children, pg, env, shell_write).await; if interactive { sys::set_foreground_pg(nix::unistd::getpid())?; } @@ -275,12 +275,12 @@ async fn write_event( Ok(()) } -fn spawn_children<'a>( +fn spawn_children( pipeline: crate::parse::Pipeline, - env: &'a Env, + env: &Env, io: &builtins::Io, interactive: bool, -) -> anyhow::Result<(Vec>, Option)> { +) -> anyhow::Result<(Vec, Option)> { let mut cmds: Vec<_> = pipeline .into_exes() .map(|exe| Command::new(exe, io.clone())) @@ -318,10 +318,9 @@ fn spawn_children<'a>( } async fn wait_children( - children: Vec>, + children: Vec, pg: Option, env: &Env, - io: &builtins::Io, shell_write: &mut Option, ) -> std::process::ExitStatus { enum Res { @@ -331,11 +330,7 @@ async fn wait_children( macro_rules! bail { ($e:expr) => { - // if writing to stderr is not possible, we still want to exit - // normally with a failure exit code - #[allow(clippy::let_underscore_drop)] - let _ = - io.write_stderr(format!("nbsh: {}\n", $e).as_bytes()).await; + eprintln!("nbsh: {}\n", $e); return std::process::ExitStatus::from_raw(1 << 8); }; } -- cgit v1.2.3-54-g00ecf