From 2931d869d5c8f91740b27dac74466c305533b906 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 29 Jun 2019 15:38:00 -0700 Subject: [PATCH] Remove the foreground job property This was not used consistently and was confused with the foreground job flag. Whether a job is foreground is mutable, so it should remain a flag. --- src/parse_execution.cpp | 2 +- src/proc.h | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index 1f82c768b..eff62a4e6 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -1239,7 +1239,6 @@ parse_execution_result_t parse_execution_context_t::run_1_job(tnode_t jo ((job_control_mode == job_control_t::interactive) && parser->is_interactive()); job_t::properties_t props{}; - props.foreground = !job_node_is_background(job_node); props.wants_terminal = wants_job_control && !ld.is_event; props.skip_notification = ld.is_subshell || ld.is_block || ld.is_event || !parser->is_interactive(); @@ -1248,6 +1247,7 @@ parse_execution_result_t parse_execution_context_t::run_1_job(tnode_t jo shared_ptr job = std::make_shared(acquire_job_id(), props, block_io, parent_job); job->tmodes = tmodes; + job->set_flag(job_flag_t::FOREGROUND, !job_node_is_background(job_node)); job->set_flag(job_flag_t::JOB_CONTROL, wants_job_control); // We are about to populate a job. One possible argument to the job is a command substitution diff --git a/src/proc.h b/src/proc.h index 414314649..faa906f84 100644 --- a/src/proc.h +++ b/src/proc.h @@ -287,9 +287,6 @@ class job_t { /// A set of jobs properties. These are immutable: they do not change for the lifetime of the /// job. struct properties_t { - /// Whether this job is in the foreground, i.e. whether it did NOT have a & at the end. - bool foreground{}; - /// Whether the specified job is a part of a subshell, event handler or some other form of /// special job that should not be reported. bool skip_notification{}; @@ -414,7 +411,7 @@ class job_t { /// The job has been fully constructed, i.e. all its member processes have been launched bool is_constructed() const { return get_flag(job_flag_t::CONSTRUCTED); } /// The job was launched in the foreground and has control of the terminal - bool is_foreground() const { return properties.foreground; } + bool is_foreground() const { return get_flag(job_flag_t::FOREGROUND); } /// The job is complete, i.e. all its member processes have been reaped bool is_completed() const; /// The job is in a stopped state