mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 02:27:28 +08:00
Store the command that produced a job group in the group
This will enable us to replace more uses of jobs with job groups.
This commit is contained in:
parent
f1302d336a
commit
40c9bda7fd
|
@ -293,7 +293,7 @@ void job_group_t::populate_group_for_job(job_t *job, const job_group_ref_t &prop
|
|||
props.wants_terminal = job->wants_job_control() && !job->from_event_handler();
|
||||
props.is_internal = can_use_internal;
|
||||
props.job_id = can_use_internal ? -1 : acquire_job_id();
|
||||
job->group.reset(new job_group_t(props));
|
||||
job->group.reset(new job_group_t(props, job->command()));
|
||||
|
||||
// Mark if it's foreground.
|
||||
job->group->set_is_foreground(!initial_bg);
|
||||
|
|
|
@ -212,6 +212,9 @@ class job_group_t {
|
|||
/// Get the cancel signal, or 0 if none.
|
||||
int get_cancel_signal() const { return cancel_signal_; }
|
||||
|
||||
/// \return the command which produced this job tree.
|
||||
const wcstring &get_command() const { return command_; }
|
||||
|
||||
/// Mark that a process in this group got a signal, and so should cancel.
|
||||
void set_cancel_signal(int sig) { cancel_signal_ = sig; }
|
||||
|
||||
|
@ -248,6 +251,9 @@ class job_group_t {
|
|||
};
|
||||
const properties_t props_;
|
||||
|
||||
// The original command which produced this job tree.
|
||||
const wcstring command_;
|
||||
|
||||
// Whether we are in the foreground, meaning that the user is waiting for this.
|
||||
relaxed_atomic_bool_t is_foreground_{};
|
||||
|
||||
|
@ -257,7 +263,8 @@ class job_group_t {
|
|||
// If not zero, a signal indicating cancellation.
|
||||
int cancel_signal_{};
|
||||
|
||||
explicit job_group_t(const properties_t &props) : props_(props) {}
|
||||
job_group_t(const properties_t &props, wcstring command)
|
||||
: props_(props), command_(std::move(command)) {}
|
||||
};
|
||||
|
||||
/// A structure representing a single fish process. Contains variables for tracking process state
|
||||
|
|
Loading…
Reference in New Issue
Block a user