The negation rule was not being applied when run_pipe was executed
leading to '! command' not actually negating the return code when using
modern shell.

  => cli set modern
  => ! false
  => echo $?
  <Prints 1 before this patch with the expected output being 0>

Reported-by: Rasmus Villemoes <[email protected]>
Closes: https://lore.kernel.org/u-boot/[email protected]/
Signed-off-by: Anshul Dalal <[email protected]>
---
 common/cli_hush_upstream.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/cli_hush_upstream.c b/common/cli_hush_upstream.c
index 748ef60ac90b..c01ba00e4754 100644
--- a/common/cli_hush_upstream.c
+++ b/common/cli_hush_upstream.c
@@ -10377,6 +10377,7 @@ static NOINLINE int run_pipe(struct pipe *pi)
        debug_printf_exec("run_pipe return -1 (%u children started)\n", 
pi->alive_cmds);
        return -1;
 #else /* __U_BOOT__ */
+       IF_HAS_KEYWORDS(if (pi->pi_inverted) rcode = !rcode;)
        debug_printf_exec("run_pipe return %d\n", rcode);
        return rcode;
 #endif /* __U_BOOT__ */

-- 
2.55.0

Reply via email to