Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow exec of last command in forked non-bg subshell (re: 2124f14)
The exec optimization only happened in background subshells and not in regular subshells when they had forked via sh_subfork(), which makes little sense. src/cmd/ksh93/sh/xec.c: sh_exec: case TLST: - A subshell is executed as a list of commands which is TLST. If the shell had not forked at the beginning of the subshell, the sh_state(SH_FORKED) flag was not passed on to recursive sh_exec() invocations, and a sh_subfork() event did not change this. To fix this, re-check for the SH_FORKED state and pass that bit on to the recursive sh_exec() invocation if set (note that sh_isstate() returns a bitmask and not a boolean value). src/cmd/ksh93/sh/subshell.c: sh_subfork(): - Remove redundant sh_onstate(SH_FORKED); this is already done in sh_fork() which this function calls.
- Loading branch information