mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
Rename PENDING_REMOVAL to DISOWN_REQUESTED
A commend implied that PENDING_REMOVAL was broader than it was. In practice only disown() sets this flag. Rename the flag for clarity.
This commit is contained in:
parent
b5865d2cba
commit
c05e72749a
3 changed files with 7 additions and 7 deletions
|
@ -34,7 +34,7 @@ static int disown_job(const wchar_t *cmd, parser_t &parser, io_streams_t &stream
|
||||||
// We cannot directly remove the job from the jobs() list as `disown` might be called
|
// We cannot directly remove the job from the jobs() list as `disown` might be called
|
||||||
// within the context of a subjob which will cause the parent job to crash in exec_job().
|
// within the context of a subjob which will cause the parent job to crash in exec_job().
|
||||||
// Instead, we set a flag and the parser removes the job from the jobs list later.
|
// Instead, we set a flag and the parser removes the job from the jobs list later.
|
||||||
j->set_flag(job_flag_t::PENDING_REMOVAL, true);
|
j->set_flag(job_flag_t::DISOWN_REQUESTED, true);
|
||||||
add_disowned_pgid(j->pgid);
|
add_disowned_pgid(j->pgid);
|
||||||
|
|
||||||
return STATUS_CMD_OK;
|
return STATUS_CMD_OK;
|
||||||
|
|
|
@ -537,7 +537,7 @@ static bool process_clean_after_marking(bool allow_interactive) {
|
||||||
// If the process has been previously flagged for removal, add it to the erase list without
|
// If the process has been previously flagged for removal, add it to the erase list without
|
||||||
// any further processing, but do not remove any jobs until their parent jobs have completed
|
// any further processing, but do not remove any jobs until their parent jobs have completed
|
||||||
// processing.
|
// processing.
|
||||||
if (j->get_flag(job_flag_t::PENDING_REMOVAL) && j->job_chain_is_fully_constructed()) {
|
if (j->get_flag(job_flag_t::DISOWN_REQUESTED) && j->job_chain_is_fully_constructed()) {
|
||||||
erase_list.push_back(j);
|
erase_list.push_back(j);
|
||||||
}
|
}
|
||||||
// If all processes have completed, tell the user the job has completed and delete it from
|
// If all processes have completed, tell the user the job has completed and delete it from
|
||||||
|
|
10
src/proc.h
10
src/proc.h
|
@ -255,10 +255,8 @@ enum class job_flag_t {
|
||||||
JOB_CONTROL,
|
JOB_CONTROL,
|
||||||
/// Whether the job wants to own the terminal when in the foreground.
|
/// Whether the job wants to own the terminal when in the foreground.
|
||||||
TERMINAL,
|
TERMINAL,
|
||||||
/// This job needs to be removed from the list of jobs for one reason or another (killed,
|
/// This job is disowned, and should be removed from the active jobs list.
|
||||||
/// completed, disowned, etc). This flag is set rather than directly manipulating the jobs
|
DISOWN_REQUESTED,
|
||||||
/// list.
|
|
||||||
PENDING_REMOVAL,
|
|
||||||
|
|
||||||
JOB_FLAG_COUNT
|
JOB_FLAG_COUNT
|
||||||
};
|
};
|
||||||
|
@ -399,7 +397,9 @@ class job_t {
|
||||||
/// The job is in a stopped state
|
/// The job is in a stopped state
|
||||||
bool is_stopped() const;
|
bool is_stopped() const;
|
||||||
/// The job is OK to be externally visible, e.g. to the user via `jobs`
|
/// The job is OK to be externally visible, e.g. to the user via `jobs`
|
||||||
bool is_visible() const { return !is_completed() && is_constructed() && !get_flag(job_flag_t::PENDING_REMOVAL); };
|
bool is_visible() const {
|
||||||
|
return !is_completed() && is_constructed() && !get_flag(job_flag_t::DISOWN_REQUESTED);
|
||||||
|
};
|
||||||
|
|
||||||
/// \return the parent job, or nullptr.
|
/// \return the parent job, or nullptr.
|
||||||
const std::shared_ptr<job_t> get_parent() const { return parent_job; }
|
const std::shared_ptr<job_t> get_parent() const { return parent_job; }
|
||||||
|
|
Loading…
Reference in a new issue