diff options
Diffstat (limited to 'src/exec.c')
| -rw-r--r-- | src/exec.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1239,7 +1239,11 @@ static bool subshell_in_process(const node *n) { return false; cmdinfo ci; find_command(b->u.simple.args->plain, &ci, 0); - return ci.kind == C_BUILTIN && (ci.bi->flags & (BI_PURE | BI_CD)); + if (ci.kind != C_BUILTIN) + return false; + if (ci.bi->flags & BI_CD) + return var_is_plain("PWD") && var_is_plain("OLDPWD"); + return (ci.bi->flags & BI_PURE) != 0; } /* ---- pipelines ------------------------------------------------------- */ @@ -1845,10 +1849,9 @@ static int eval_subshell(node *n, unsigned flags) { } if (ok && (sc.cmd.bi->flags & BI_CD)) { int status; - if (builtin_cd_isolated(sc.argc, sc.argv, &status)) { - scope_pop(); - return status; - } + builtin_cd_isolated(sc.argc, sc.argv, &status); + scope_pop(); + return status; } scope_pop(); if (!ok) |
