Make events per-parser

This makes the following changes:

1. Events in background threads are executed in those threads, instead of
being silently dropped

2. Blocked events are now per-parser instead of global

3. Events are posted in builtin_set instead of within the environment stack

The last one means that we no longer support event handlers for implicit
sets like (example) argv. Instead only the `set` builtin (and also `cd`)
post variable-change events.

Events from universal variable changes are still not fully rationalized.
This commit is contained in:
ridiculousfish
2019-06-03 02:31:13 -07:00
parent 890c1188ab
commit ff55249447
18 changed files with 115 additions and 72 deletions

View File

@@ -522,11 +522,12 @@ int main(int argc, char **argv) {
// TODO: The generic process-exit event is useless and unused.
// Remove this in future.
event_fire(proc_create_event(L"PROCESS_EXIT", event_type_t::exit, getpid(), exit_status));
event_fire(parser,
proc_create_event(L"PROCESS_EXIT", event_type_t::exit, getpid(), exit_status));
// Trigger any exit handlers.
wcstring_list_t event_args = {to_string(exit_status)};
event_fire_generic(L"fish_exit", &event_args);
event_fire_generic(parser, L"fish_exit", &event_args);
restore_term_mode();
restore_term_foreground_process_group();