diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-26 03:05:02 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-26 03:05:02 -0500 |
commit | e6200649a87a7fdc04ad62b6348068d61f53925a (patch) | |
tree | 0dc1104077207d1ba84f385bf3e8a7323a6f15f1 | |
parent | fc3449b2f10fb6dbb8945f05d55353b41b818345 (diff) | |
download | nbsh-e6200649a87a7fdc04ad62b6348068d61f53925a.tar.gz nbsh-e6200649a87a7fdc04ad62b6348068d61f53925a.zip |
fix and/or logic
-rw-r--r-- | src/state/history/builtins.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/state/history/builtins.rs b/src/state/history/builtins.rs index e999035..fd5b5c1 100644 --- a/src/state/history/builtins.rs +++ b/src/state/history/builtins.rs @@ -121,9 +121,10 @@ async fn and( ) -> async_std::process::ExitStatus { let exe = exe.shift(); if env.latest_status().success() { - super::run_exe(&exe, env).await; + super::run_exe(&exe, env).await + } else { + *env.latest_status() } - *env.latest_status() } async fn or( @@ -131,10 +132,11 @@ async fn or( env: &super::ProcessEnv, ) -> async_std::process::ExitStatus { let exe = exe.shift(); - if !env.latest_status().success() { - super::run_exe(&exe, env).await; + if env.latest_status().success() { + *env.latest_status() + } else { + super::run_exe(&exe, env).await } - *env.latest_status() } async fn command( |