Add vector of cleanup/termination events to be executed before quit

This commit is contained in:
Mahmoud Al-Qudsi
2018-09-28 10:53:56 -05:00
parent e045b045da
commit 8c14f0f30f
4 changed files with 16 additions and 0 deletions

View File

@@ -359,6 +359,12 @@ static bool can_use_posix_spawn_for_job(const job_t *job, const process_t *proce
void internal_exec(job_t *j, const io_chain_t &&all_ios) {
// Do a regular launch - but without forking first...
// since we are about to quit, make sure to run pending cleanup tasks
while (!before_exit.empty()) {
before_exit.top()();
before_exit.pop();
}
// setup_child_process makes sure signals are properly set up.
// PCA This is for handling exec. Passing all_ios here matches what fish 2.0.0 and 1.x did.