mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Change when PENDING_REMOVAL jobs are removed
Followup to 394623b
.
Doing it in the parser meant only top-level jobs would be reaped after
being `disown`ed, as subjobs aren't directly handled by the parser.
This is also much cleaner, as now job removal is centralized in
`process_clean_after_marking()`.
Closes #5803.
This commit is contained in:
parent
83e72c912d
commit
04a96f6c6e
3 changed files with 8 additions and 7 deletions
|
@ -1269,11 +1269,6 @@ parse_execution_result_t parse_execution_context_t::run_1_job(tnode_t<g::job> jo
|
|||
remove_job(job.get());
|
||||
}
|
||||
|
||||
// This job was disowned during its own execution or the execution of its subjobs
|
||||
if (job->get_flag(job_flag_t::PENDING_REMOVAL)) {
|
||||
remove_job(job.get());
|
||||
}
|
||||
|
||||
// Only external commands require a new fishd barrier.
|
||||
if (job_contained_external_command) {
|
||||
set_proc_had_barrier(false);
|
||||
|
|
|
@ -542,9 +542,15 @@ static bool process_clean_after_marking(bool allow_interactive) {
|
|||
p->status = proc_status_t::from_exit_code(0);
|
||||
}
|
||||
|
||||
// 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
|
||||
// processing.
|
||||
if (j->get_flag(job_flag_t::PENDING_REMOVAL) && j->job_chain_is_fully_constructed()) {
|
||||
erase_list.push_back(j);
|
||||
}
|
||||
// If all processes have completed, tell the user the job has completed and delete it from
|
||||
// the active job list.
|
||||
if (j->is_completed()) {
|
||||
else if (j->is_completed()) {
|
||||
if (!j->is_foreground() && !j->get_flag(job_flag_t::NOTIFIED) &&
|
||||
!j->get_flag(job_flag_t::SKIP_NOTIFICATION)) {
|
||||
print_job_status(j.get(), JOB_ENDED);
|
||||
|
|
|
@ -401,7 +401,7 @@ class job_t {
|
|||
/// The job is in a stopped state
|
||||
bool is_stopped() const;
|
||||
/// 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::PENDING_REMOVAL) && !parent_job; };
|
||||
|
||||
/// \return the parent job, or nullptr.
|
||||
const std::shared_ptr<job_t> get_parent() const { return parent_job; }
|
||||
|
|
Loading…
Reference in a new issue