From b61cdb44128b4c6be29b7dbac3a5dd58ad5fe53f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 7 Jan 2023 14:00:50 -0600 Subject: [PATCH] Subshell all piped segments. (Creating new child block before pipe status check: look at parent block.) --- toys/pending/sh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toys/pending/sh.c b/toys/pending/sh.c index 6090d271..70989e68 100644 --- a/toys/pending/sh.c +++ b/toys/pending/sh.c @@ -3726,7 +3726,7 @@ static void run_lines(void) // TODO test background a block: { abc; } & // If we spawn a subshell, pass data off to child process - if (TT.ff->blk->pipe || !strcmp(s, "(") || (ctl && !strcmp(ctl, "&"))) { + if (TT.ff->blk->next->pipe || !strcmp(s, "(") || (ctl && !strcmp(ctl, "&"))) { if (!(pp->pid = run_subshell(0, -1))) { // zap forked child's cleanup context and advance to next statement -- 2.39.2