mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 21:09:28 +00: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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208881
@ -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 New Issue
Block a user