From e6200649a87a7fdc04ad62b6348068d61f53925a Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 26 Dec 2021 03:05:02 -0500 Subject: fix and/or logic --- src/state/history/builtins.rs | 12 +++++++----- 1 file 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( -- cgit v1.2.3-54-g00ecf