mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-16 01:51:16 -03:00
Prevent disown from directly removing jobs
This prevents the `disown` builtin from directly removing jobs out of the jobs list to prevent sanity issues, as `disown` may be called within the context of a subjob (e.g. in a function or block) in which case the parent job might not yet be done with the reference to the child job. Instead, a flag is set and the parser removes the job from the list only after the entire execution chain has completed. Closes #5720.
This commit is contained in:
@@ -1269,6 +1269,11 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user