From b3991b836e6194fa89c4a64768686aa03da0187b Mon Sep 17 00:00:00 2001 From: Danny Rosseau <daniel.rosseau@gmail.com> Date: Mon, 17 Jul 2017 17:20:26 -0600 Subject: [PATCH] Conditionals && and || weren't working as expected --- examples/conditionals.ion | 9 +++++++++ examples/conditionals.out | 7 +++++++ src/shell/pipe.rs | 2 -- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 examples/conditionals.ion create mode 100644 examples/conditionals.out diff --git a/examples/conditionals.ion b/examples/conditionals.ion new file mode 100644 index 00000000..46c1b24b --- /dev/null +++ b/examples/conditionals.ion @@ -0,0 +1,9 @@ +true && echo and || echo or +false && echo and || echo or +false || echo false +true && echo true +true || echo cant get here +false && echo cant get here +false || false || echo double or +true && true && echo double and +false || true && echo or and diff --git a/examples/conditionals.out b/examples/conditionals.out new file mode 100644 index 00000000..1bb8764d --- /dev/null +++ b/examples/conditionals.out @@ -0,0 +1,7 @@ +and +or +false +true +double or +double and +or and diff --git a/src/shell/pipe.rs b/src/shell/pipe.rs index a76ffedf..baf8375e 100644 --- a/src/shell/pipe.rs +++ b/src/shell/pipe.rs @@ -273,12 +273,10 @@ pub fn pipe ( match previous_kind { JobKind::And => if previous_status != SUCCESS { if let JobKind::Or = kind { previous_kind = kind } - commands.next(); continue }, JobKind::Or => if previous_status == SUCCESS { if let JobKind::And = kind { previous_kind = kind } - commands.next(); continue }, _ => () -- GitLab