diff options
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/exec.c b/Src/exec.c index 2301f85ad..6f09e0d9f 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2901,11 +2901,13 @@ execcmd_exec(Estate state, Execcmd_params eparams, pushnode(args, dupstring("fg")); } - if ((how & Z_ASYNC) || output) { + if ((how & Z_ASYNC) || output || + (last1 == 2 && input && EMULATION(EMULATE_SH))) { /* - * If running in the background, or not the last command in a - * pipeline, we don't need any of the rest of this function to - * affect the state in the main shell, so fork immediately. + * If running in the background, not the last command in a + * pipeline, or the last command in a multi-stage pipeline + * in sh mode, we don't need any of the rest of this function + * to affect the state in the main shell, so fork immediately. * * In other cases we may need to process the command line * a bit further before we make the decision. |