summaryrefslogtreecommitdiffstats
path: root/src/pipeline/mod.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-07 23:42:32 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-08 00:00:57 -0500
commit9dd1d992bd2344d8824e69d8f47c9009a6caf021 (patch)
treea2b3682c41a182bbb3b031e5c458ff93c460e53f /src/pipeline/mod.rs
parenta2d265ce727caf4e8cd4bad034ef8ae830346fc3 (diff)
downloadnbsh-9dd1d992bd2344d8824e69d8f47c9009a6caf021.tar.gz
nbsh-9dd1d992bd2344d8824e69d8f47c9009a6caf021.zip
large refactor
Diffstat (limited to 'src/pipeline/mod.rs')
-rw-r--r--src/pipeline/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs
index 015eeef..a54951c 100644
--- a/src/pipeline/mod.rs
+++ b/src/pipeline/mod.rs
@@ -37,7 +37,8 @@ async fn run_with_env(
env: &mut Env,
shell_write: &async_std::fs::File,
) -> anyhow::Result<()> {
- let pipeline = crate::parse::Pipeline::parse(env.pipeline().unwrap())?;
+ let pipeline =
+ crate::parse::ast::Pipeline::parse(env.pipeline().unwrap())?;
let (children, pg) = spawn_children(pipeline, env)?;
let status = wait_children(children, pg, env, shell_write).await;
env.set_status(status);
@@ -61,9 +62,10 @@ async fn write_event(
}
fn spawn_children(
- pipeline: crate::parse::Pipeline,
+ pipeline: crate::parse::ast::Pipeline,
env: &Env,
) -> anyhow::Result<(Vec<Child>, Option<nix::unistd::Pid>)> {
+ let pipeline = pipeline.eval(env);
let mut cmds: Vec<_> = pipeline.into_exes().map(Command::new).collect();
for i in 0..(cmds.len() - 1) {
let (r, w) = pipe()?;