mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-22 20:31:15 -03:00
Let parser::set_var_and_fire fire the event directly
The vector here gives us *nothing*
This commit is contained in:
@@ -517,6 +517,16 @@ event_t event_t::variable(wcstring name, wcstring_list_t args) {
|
||||
return evt;
|
||||
}
|
||||
|
||||
// static
|
||||
event_t event_t::variable_erase(wcstring name) {
|
||||
return event_t::variable(name, {L"VARIABLE", L"ERASE", name});
|
||||
}
|
||||
|
||||
// static
|
||||
event_t event_t::variable_set(wcstring name) {
|
||||
return event_t::variable(name, {L"VARIABLE", L"SET", name});
|
||||
}
|
||||
|
||||
// static
|
||||
event_t event_t::process_exit(pid_t pid, int status) {
|
||||
event_t evt{event_type_t::process_exit};
|
||||
|
||||
@@ -107,6 +107,10 @@ struct event_t {
|
||||
|
||||
/// Create an event_type_t::variable event.
|
||||
static event_t variable(wcstring name, wcstring_list_t args);
|
||||
/// Create an event_type_t::variable event with the args for erasing a variable.
|
||||
static event_t variable_erase(wcstring name);
|
||||
/// Create an event_type_t::variable event with the args for setting a variable.
|
||||
static event_t variable_set(wcstring name);
|
||||
|
||||
/// Create a PROCESS_EXIT event.
|
||||
static event_t process_exit(pid_t pid, int status);
|
||||
|
||||
@@ -102,10 +102,9 @@ parser_t &parser_t::principal_parser() {
|
||||
}
|
||||
|
||||
int parser_t::set_var_and_fire(const wcstring &key, env_mode_flags_t mode, wcstring_list_t vals) {
|
||||
std::vector<event_t> events;
|
||||
int res = vars().set(key, mode, std::move(vals), &events);
|
||||
for (const auto &evt : events) {
|
||||
event_fire(*this, evt);
|
||||
int res = vars().set(key, mode, std::move(vals), nullptr);
|
||||
if (res == ENV_OK) {
|
||||
event_fire(*this, event_t::variable_set(key));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user