Pass final Fish exit status to fish_exit event

For fish_exit to be a suitable replacement for --on-process-exit, we need to be able to provide scripts with access to the shell's final exit code.
This commit is contained in:
Stephen M. Coakley 2019-01-03 22:20:43 -06:00 committed by Fabian Homborg
parent 896d6f41f4
commit d776a366fa

View File

@ -440,7 +440,10 @@ int main(int argc, char **argv) {
// TODO: The generic process-exit event is useless and unused.
// Remove this in future.
proc_fire_event(L"PROCESS_EXIT", EVENT_EXIT, getpid(), exit_status);
event_fire_generic(L"fish_exit");
// Trigger any exit handlers.
wcstring_list_t event_args = {to_string<int>(exit_status)};
event_fire_generic(L"fish_exit", &event_args);
restore_term_mode();
restore_term_foreground_process_group();