mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 09:12:11 +08:00
Merge pull request #5293 from mqudsi/issue_5292
Block on fg processes even if not under job control
This commit is contained in:
commit
913f65cd77
17
src/proc.cpp
17
src/proc.cpp
@ -421,8 +421,7 @@ static bool process_mark_finished_children(bool block_on_fg) {
|
||||
// wait on only one pgrp at a time and we need to check all pgrps before returning, but we
|
||||
// never wait/block on fg processes after an error has been encountered to give ourselves
|
||||
// (elsewhere) a chance to handle the fallout from process termination, etc.
|
||||
if (!has_error && block_on_fg && j->pgid != shell_pgid && j == job_fg &&
|
||||
j->get_flag(job_flag_t::JOB_CONTROL)) {
|
||||
if (!has_error && block_on_fg && j == job_fg) {
|
||||
debug(4, "Waiting on processes from foreground job %d", job_fg->pgid);
|
||||
options &= ~WNOHANG;
|
||||
}
|
||||
@ -479,7 +478,11 @@ static bool process_mark_finished_children(bool block_on_fg) {
|
||||
// waitpid for one pgrp at a time. We do bypass future waits in case of error,
|
||||
// however.
|
||||
has_error = true;
|
||||
wperror(L"waitpid in process_mark_finished_children");
|
||||
|
||||
// Do not audibly complain on interrupt (see #5293)
|
||||
if (errno != EINTR) {
|
||||
wperror(L"waitpid in process_mark_finished_children");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1096,18 +1099,14 @@ void job_t::continue_job(bool send_sigcont) {
|
||||
break;
|
||||
|
||||
case select_try_t::TIMEOUT:
|
||||
// Our select_try() timeout is ~10ms, so this can be EXTREMELY chatty but this
|
||||
// is very useful if trying to debug an unknown hang in fish. Uncomment to see
|
||||
// if we're stuck here.
|
||||
|
||||
// debug(1, L"select_try: no fds returned valid data within the timeout" );
|
||||
|
||||
// No FDs are ready. Look for finished processes instead.
|
||||
debug(4, L"select_try: no fds returned valid data within the timeout" );
|
||||
process_mark_finished_children(block_on_fg);
|
||||
break;
|
||||
|
||||
case select_try_t::IOCHAIN_EMPTY:
|
||||
// There were no IO fds to select on.
|
||||
debug(4, L"select_try: no IO fds" );
|
||||
process_mark_finished_children(true);
|
||||
|
||||
// If it turns out that we encountered this because the file descriptor we were
|
||||
|
Loading…
x
Reference in New Issue
Block a user