summaryrefslogtreecommitdiffstats
path: root/src/shell/history/mod.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-08 14:58:23 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-08 14:58:23 -0500
commit98617b70d8e85053c1ca56f26c58d49d880a0ce1 (patch)
treece3f29ba8239715a368ae78027df47e26c95e571 /src/shell/history/mod.rs
parent82b885d8f12fc9ccb02a7e77799ced063d2df29e (diff)
downloadnbsh-98617b70d8e85053c1ca56f26c58d49d880a0ce1.tar.gz
nbsh-98617b70d8e85053c1ca56f26c58d49d880a0ce1.zip
remove pipeline from the environment
it was only really here for convenience, but it doesn't really make a lot of sense
Diffstat (limited to 'src/shell/history/mod.rs')
-rw-r--r--src/shell/history/mod.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/shell/history/mod.rs b/src/shell/history/mod.rs
index 9e1d1fd..55f2d8a 100644
--- a/src/shell/history/mod.rs
+++ b/src/shell/history/mod.rs
@@ -300,8 +300,14 @@ fn run_commands(
};
for pipeline in ast.pipelines() {
- env.set_pipeline(pipeline.input_string().to_string());
- match run_pipeline(&pty, &mut env, event_w.clone()).await {
+ match run_pipeline(
+ pipeline.input_string(),
+ &pty,
+ &mut env,
+ event_w.clone(),
+ )
+ .await
+ {
Ok((pipeline_status, done)) => {
env.set_status(pipeline_status);
if done {
@@ -326,6 +332,7 @@ fn run_commands(
}
async fn run_pipeline(
+ pipeline: &str,
pty: &pty::Pty,
env: &mut Env,
event_w: async_std::channel::Sender<Event>,
@@ -352,6 +359,9 @@ async fn run_pipeline(
// Safety: to_w was just opened above, was not used until now, and can't
// be used after this because we rebound the variable
let mut to_w = unsafe { async_std::fs::File::from_raw_fd(to_w) };
+ to_w.write_all(&bincode::serialize(pipeline).unwrap())
+ .await
+ .unwrap();
to_w.write_all(&env.as_bytes()).await.unwrap();
drop(to_w);