diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-05 06:51:19 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-05 06:51:19 -0500 |
commit | e893d7cb8ca855e2843f60ec0b1045510e1577cf (patch) | |
tree | 18277916f4567d250e7361cd3abfe2bcb8456092 | |
parent | 53193c426d19d529382e75e8af4ab9266b992557 (diff) | |
download | nbsh-e893d7cb8ca855e2843f60ec0b1045510e1577cf.tar.gz nbsh-e893d7cb8ca855e2843f60ec0b1045510e1577cf.zip |
refactor
-rw-r--r-- | src/env.rs | 5 | ||||
-rw-r--r-- | src/pipeline/mod.rs | 4 |
2 files changed, 7 insertions, 2 deletions
@@ -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())?; } |