mirror of
https://github.com/opnsense/src.git
synced 2026-04-01 23:45:12 -04:00
sh: Pass through SIGINT from a child if interactive and job control
is enabled. This already worked if without job control. In either case, this depends on it that a process that terminates due to SIGINT exits on it (so not with status 1, or worse, 0). Example: sleep 5; echo continued This does not print "continued" any more if sleep is aborted via ctrl+c. MFC after: 1 month
This commit is contained in:
parent
8ce4a9a255
commit
f3d893fcde
1 changed files with 6 additions and 0 deletions
|
|
@ -866,6 +866,7 @@ waitforjob(struct job *jp, int *origstatus)
|
|||
{
|
||||
#if JOBS
|
||||
pid_t mypgrp = getpgrp();
|
||||
int propagate_int = jp->jobctl && jp->foreground;
|
||||
#endif
|
||||
int status;
|
||||
int st;
|
||||
|
|
@ -903,6 +904,11 @@ waitforjob(struct job *jp, int *origstatus)
|
|||
else
|
||||
CLEAR_PENDING_INT;
|
||||
}
|
||||
#if JOBS
|
||||
else if (rootshell && iflag && propagate_int &&
|
||||
WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
|
||||
kill(getpid(), SIGINT);
|
||||
#endif
|
||||
INTON;
|
||||
return st;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue