mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-05-21 12:01:54 +02:00
45837: fix process group restoration upon exit
This commit is contained in:
parent
c2cf21c8f0
commit
f1e7481b86
4 changed files with 19 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
|||
2024-02-18 Stephane Chazelas <stephane@chazelas.org>
|
||||
|
||||
* 45837: Src/exec.c, Src/init.c, Src/options.c: fix issue whereby
|
||||
original process group is not restored properly upon exit when
|
||||
exec {var} redirs are used or MONITOR is temporarily disabled.
|
||||
|
||||
2024-02-18 Stephane Chazelas <stephane@chazelas.org>
|
||||
|
||||
* 52515: Src/exec.c (+ tests in 52527) avoid sh errors when
|
||||
|
|
|
@ -3768,7 +3768,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
|
|||
addfd(forked, save, mfds, fn->fd1, fil, 0, fn->varid);
|
||||
/* If this is 'exec < file', read from stdin, *
|
||||
* not terminal, unless `file' is a terminal. */
|
||||
if (nullexec == 1 && fn->fd1 == 0 &&
|
||||
if (nullexec == 1 && fn->fd1 == 0 && !fn->varid &&
|
||||
isset(SHINSTDIN) && interact && !zleactive)
|
||||
init_io(NULL);
|
||||
break;
|
||||
|
|
13
Src/init.c
13
Src/init.c
|
@ -700,11 +700,14 @@ init_io(char *cmd)
|
|||
* process group leader.
|
||||
*/
|
||||
mypid = (zlong)getpid();
|
||||
if (opts[MONITOR] && (SHTTY != -1)) {
|
||||
origpgrp = GETPGRP();
|
||||
acquire_pgrp(); /* might also clear opts[MONITOR] */
|
||||
} else
|
||||
opts[MONITOR] = 0;
|
||||
if (opts[MONITOR]) {
|
||||
if (SHTTY == -1)
|
||||
opts[MONITOR] = 0;
|
||||
else if (!origpgrp) {
|
||||
origpgrp = GETPGRP();
|
||||
acquire_pgrp(); /* might also clear opts[MONITOR] */
|
||||
}
|
||||
}
|
||||
#else
|
||||
opts[MONITOR] = 0;
|
||||
#endif
|
||||
|
|
|
@ -881,11 +881,12 @@ dosetopt(int optno, int value, int force, char *new_opts)
|
|||
} else if (!force && optno == MONITOR && value) {
|
||||
if (new_opts[optno] == value)
|
||||
return 0;
|
||||
if (SHTTY != -1) {
|
||||
if (SHTTY == -1)
|
||||
return -1;
|
||||
if (!origpgrp) {
|
||||
origpgrp = GETPGRP();
|
||||
acquire_pgrp();
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
} else if(optno == MONITOR && value) {
|
||||
return -1;
|
||||
|
|
Loading…
Reference in a new issue