mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix 'redirect {var}>file' in subshell (re: 7b82c338
)
Permanent redirections of that form broke in subshells when used
with the 'redirect' command, because I had overlooked one instance
where the new 'redirect' builtin needs to match the behaviour of
the 'exec' builtin.
src/cmd/ksh93/tests/io.sh: sh_exec():
- Do not restore file descriptors in (virtual) subshells for
'redirect' just as this isn't done for 'exec'.
src/cmd/ksh93/tests/io.sh:
- Add regression test for this bug.
- Complete the test for f9427909
which I committed prematurely.
Fixes: https://github.com/ksh93/ksh/issues/167
This commit is contained in:
parent
f9427909dc
commit
7b59fb805c
2 changed files with 9 additions and 4 deletions
|
@ -1401,8 +1401,8 @@ int sh_exec(register const Shnode_t *t, int flags)
|
|||
sh_unscope(shp);
|
||||
bp->ptr = (void*)save_ptr;
|
||||
bp->data = (void*)save_data;
|
||||
/* don't restore for subshell exec */
|
||||
if((shp->topfd>topfd) && !(shp->subshell && np==SYSEXEC))
|
||||
/* don't restore for 'exec' or 'redirect' in subshell */
|
||||
if((shp->topfd>topfd) && !(shp->subshell && (np==SYSEXEC || np==SYSREDIR)))
|
||||
sh_iorestore(shp,topfd,jmpval);
|
||||
|
||||
shp->redir0 = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue