summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-05 06:51:19 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-05 06:51:19 -0500
commite893d7cb8ca855e2843f60ec0b1045510e1577cf (patch)
tree18277916f4567d250e7361cd3abfe2bcb8456092 /src
parent53193c426d19d529382e75e8af4ab9266b992557 (diff)
downloadnbsh-e893d7cb8ca855e2843f60ec0b1045510e1577cf.tar.gz
nbsh-e893d7cb8ca855e2843f60ec0b1045510e1577cf.zip
refactor
Diffstat (limited to 'src')
-rw-r--r--src/env.rs5
-rw-r--r--src/pipeline/mod.rs4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/env.rs b/src/env.rs
index c6a4056..6e5f3e5 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -90,6 +90,11 @@ impl Env {
}
}
+ pub fn update(&mut self) -> anyhow::Result<()> {
+ self.set_current_dir(std::env::current_dir()?);
+ Ok(())
+ }
+
pub fn as_bytes(&self) -> Vec<u8> {
bincode::serialize(self).unwrap()
}
diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs
index 43170da..fc6fdb0 100644
--- a/src/pipeline/mod.rs
+++ b/src/pipeline/mod.rs
@@ -26,10 +26,10 @@ pub async fn run() -> anyhow::Result<i32> {
let mut env = read_data(shell_read).await?;
run_with_env(&mut env, &shell_write).await?;
let status = *env.latest_status();
- let pwd = std::env::current_dir()?;
- env.set_current_dir(pwd);
+ env.update()?;
write_event(&shell_write, Event::Exit(env)).await?;
+
if let Some(signal) = status.signal() {
nix::sys::signal::raise(signal.try_into().unwrap())?;
}