Skip pre/post exec events for empty commands (#4829)

This commit is contained in:
Awal Garg
2020-06-06 08:46:39 +05:30
committed by ridiculousfish
parent c5e535e794
commit cb5eb72c6b
3 changed files with 6 additions and 4 deletions

View File

@@ -2478,10 +2478,10 @@ static int read_i(parser_t &parser) {
data->command_line.clear();
data->command_line_changed(&data->command_line);
wcstring_list_t argv(1, command);
event_fire_generic(parser, L"fish_preexec", &argv);
if (!command.empty()) event_fire_generic(parser, L"fish_preexec", &argv);
reader_run_command(parser, command);
parser.clear_cancel();
event_fire_generic(parser, L"fish_postexec", &argv);
if (!command.empty()) event_fire_generic(parser, L"fish_postexec", &argv);
// Allow any pending history items to be returned in the history array.
if (data->history) {
data->history->resolve_pending();