diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-17 02:50:49 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-17 02:54:14 -0500 |
commit | e3250575690f85f7b35c4eae585fbbea106e1cb0 (patch) | |
tree | 2be4a8e7fed4e6d31d553a95a1f5c5db0d7f3d8a /src/runner/mod.rs | |
parent | 9a1bfdc13f69dbade1006517ed60f2eca756307a (diff) | |
download | nbsh-e3250575690f85f7b35c4eae585fbbea106e1cb0.tar.gz nbsh-e3250575690f85f7b35c4eae585fbbea106e1cb0.zip |
don't update status for commands that are part of control statements
Diffstat (limited to 'src/runner/mod.rs')
-rw-r--r-- | src/runner/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runner/mod.rs b/src/runner/mod.rs index 63af51b..84be9a1 100644 --- a/src/runner/mod.rs +++ b/src/runner/mod.rs @@ -107,12 +107,14 @@ async fn run_commands( stack.push(Frame::If(false)); } if should { + let status = env.latest_status(); run_pipeline(pipeline.clone(), env, shell_write).await?; if let Some(Frame::If(should)) = stack.top_mut() { *should = env.latest_status().success(); } else { unreachable!(); } + env.set_status(status); } pc += 1; } @@ -122,12 +124,14 @@ async fn run_commands( stack.push(Frame::While(false, pc)); } if should { + let status = env.latest_status(); run_pipeline(pipeline.clone(), env, shell_write).await?; if let Some(Frame::While(should, _)) = stack.top_mut() { *should = env.latest_status().success(); } else { unreachable!(); } + env.set_status(status); } pc += 1; } |