Remove the send_sigcont from continue_job

We can just send sigcont if the job is stopped; no need to make this an
explicit param.
This commit is contained in:
ridiculousfish 2020-07-26 16:51:11 -07:00
parent 84b25855b0
commit 1823f5d95f
5 changed files with 11 additions and 10 deletions

View file

@ -32,7 +32,7 @@ static int send_to_bg(parser_t &parser, io_streams_t &streams, job_t *j) {
j->command_wcstr());
parser.job_promote(j);
j->group->set_is_foreground(false);
j->continue_job(parser, true, j->is_stopped());
j->continue_job(parser, true);
return STATUS_CMD_OK;
}

View file

@ -107,6 +107,6 @@ int builtin_fg(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
parser.job_promote(job);
job->group->set_is_foreground(true);
job->continue_job(parser, true, job->is_stopped());
job->continue_job(parser, true);
return STATUS_CMD_OK;
}

View file

@ -1003,7 +1003,7 @@ bool exec_job(parser_t &parser, const shared_ptr<job_t> &j, const io_chain_t &bl
return false;
}
j->continue_job(parser, reclaim_foreground_pgrp, false);
j->continue_job(parser, reclaim_foreground_pgrp);
return true;
}

View file

@ -896,7 +896,7 @@ maybe_t<pid_t> job_t::get_pgid() const { return group->get_pgid(); }
job_id_t job_t::job_id() const { return group->get_id(); }
void job_t::continue_job(parser_t &parser, bool reclaim_foreground_pgrp, bool send_sigcont) {
void job_t::continue_job(parser_t &parser, bool reclaim_foreground_pgrp) {
// Put job first in the job list.
parser.job_promote(this);
mut_flags().notified = false;
@ -904,6 +904,9 @@ void job_t::continue_job(parser_t &parser, bool reclaim_foreground_pgrp, bool se
int pgid = -2;
if (auto tmp = get_pgid()) pgid = *tmp;
// We must send_sigcont if the job is stopped.
bool send_sigcont = this->is_stopped();
FLOGF(proc_job_run, L"%ls job %d, gid %d (%ls), %ls, %ls",
send_sigcont ? L"Continue" : L"Start", job_id(), pgid, command_wcstr(),
is_completed() ? L"COMPLETED" : L"UNCOMPLETED",

View file

@ -454,14 +454,12 @@ class job_t {
/// \return whether this job and its parent chain are fully constructed.
bool job_chain_is_fully_constructed() const;
/// Resume a (possibly) stopped job. Puts job in the foreground. If cont is true, restore the
/// saved terminal modes and send the process group a SIGCONT signal to wake it up before we
/// block.
/// Continues running a job, which may be stopped, or may just have started.
/// This will send SIGCONT if the job is stopped.
///
/// \param reclaim_foreground_pgrp whether, when the job finishes or stops, to reclaim the
/// foreground pgrp (via tcsetpgrp). \param send_sigcont Whether SIGCONT should be sent to the
/// job if it is in the foreground.
void continue_job(parser_t &parser, bool reclaim_foreground_pgrp, bool send_sigcont);
/// foreground pgrp (via tcsetpgrp).
void continue_job(parser_t &parser, bool reclaim_foreground_pgrp);
/// Send the specified signal to all processes in this job.
/// \return true on success, false on failure.