mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 03:32:44 +08:00
Make job_control a constant property of job_t
It no longer changes.
This commit is contained in:
parent
ce88e8739f
commit
91df645c62
|
@ -918,12 +918,6 @@ bool exec_job(parser_t &parser, const shared_ptr<job_t> &j, const job_lineage_t
|
|||
// Check to see if we should reclaim the foreground pgrp after the job finishes or stops.
|
||||
const bool reclaim_foreground_pgrp = (tcgetpgrp(STDIN_FILENO) == pgrp);
|
||||
|
||||
// If we are running nested inside a function or block with job control, then we need job
|
||||
// control too.
|
||||
if (lineage.root_has_job_control) {
|
||||
j->mut_flags().job_control = true;
|
||||
}
|
||||
|
||||
// Perhaps we know our pgroup already.
|
||||
assert(j->pgid == INVALID_PID && "Should not yet have a pid.");
|
||||
switch (j->pgroup_provenance) {
|
||||
|
|
|
@ -1273,12 +1273,12 @@ end_execution_reason_t parse_execution_context_t::run_1_job(tnode_t<g::job> job_
|
|||
props.skip_notification =
|
||||
ld.is_subshell || ld.is_block || ld.is_event || !parser->is_interactive();
|
||||
props.from_event_handler = ld.is_event;
|
||||
props.job_control = wants_job_control;
|
||||
|
||||
shared_ptr<job_t> job = std::make_shared<job_t>(acquire_job_id(), props, this->lineage);
|
||||
job->tmodes = tmodes;
|
||||
|
||||
job->mut_flags().foreground = !job_node_is_background(job_node);
|
||||
job->mut_flags().job_control = wants_job_control;
|
||||
|
||||
// We are about to populate a job. One possible argument to the job is a command substitution
|
||||
// which may be interested in the job that's populating it, via '--on-job-exit caller'. Record
|
||||
|
|
|
@ -329,6 +329,9 @@ class job_t {
|
|||
|
||||
/// Whether this job was created as part of an event handler.
|
||||
bool from_event_handler{};
|
||||
|
||||
/// Whether the job is under job control, i.e. has its own pgrp.
|
||||
bool job_control{};
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -443,9 +446,6 @@ class job_t {
|
|||
/// Whether the exit status should be negated. This flag can only be set by the not builtin.
|
||||
bool negate{false};
|
||||
|
||||
/// Whether the job is under job control, i.e. has its own pgrp.
|
||||
bool job_control{false};
|
||||
|
||||
/// This job is disowned, and should be removed from the active jobs list.
|
||||
bool disown_requested{false};
|
||||
|
||||
|
@ -460,7 +460,7 @@ class job_t {
|
|||
flags_t &mut_flags() { return job_flags; }
|
||||
|
||||
/// \return if we want job control.
|
||||
bool wants_job_control() const { return flags().job_control; }
|
||||
bool wants_job_control() const { return properties.job_control; }
|
||||
|
||||
/// \return if this job should own the terminal when it runs.
|
||||
bool should_claim_terminal() const { return properties.wants_terminal && is_foreground(); }
|
||||
|
|
Loading…
Reference in New Issue
Block a user