mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 01:36:39 +08:00
Use a real flag to mark that a process has generated an exit event
Exited processes generate event_t::process_exit if they exit with a nonzero status. Prior to this change, to avoid sending duplicate events, we would clear the status. This is ugly since we're lying about the process exit status. Use a real flag to prevent sending duplicate notifications.
This commit is contained in:
parent
7993987b23
commit
9b1e04dba2
|
@ -536,10 +536,10 @@ static void remove_disowned_jobs(job_list_t &jobs) {
|
|||
/// \return true if we printed a status message, false if not.
|
||||
static bool try_clean_process_in_job(parser_t &parser, process_t *p, job_t *j,
|
||||
std::vector<event_t> *exit_events) {
|
||||
if (!p->completed || !p->pid) {
|
||||
if (p->marked_exit_event || !p->completed || !p->pid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
p->marked_exit_event = true;
|
||||
auto s = p->status;
|
||||
|
||||
// Add an exit event if the process did not come from a job handler.
|
||||
|
@ -573,9 +573,6 @@ static bool try_clean_process_in_job(parser_t &parser, process_t *p, job_t *j,
|
|||
args.push_back(p->argv0());
|
||||
}
|
||||
call_job_summary(parser, args);
|
||||
// Clear status so it is not reported more than once.
|
||||
// TODO: this seems like a clumsy way to ensure that.
|
||||
p->status = proc_status_t::from_exit_code(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -278,6 +278,9 @@ class process_t : noncopyable_t {
|
|||
/// True if process has stopped.
|
||||
bool stopped{false};
|
||||
|
||||
/// Set once we have generated (or decided not to generate) a process_exit event.
|
||||
bool marked_exit_event{false};
|
||||
|
||||
/// Reported status value.
|
||||
proc_status_t status{};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user