From 61e948454f463e0adcb94e88a712d61958b270f0 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 6 Jun 2020 17:16:45 -0700 Subject: [PATCH] Do even less work for empty commands Inspired by #4829, skip further work when running a command interactively if that command is empty. --- src/reader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index 20f67f57d..e97cab7d0 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -2472,16 +2472,16 @@ static int read_i(parser_t &parser) { if (shell_is_exiting()) { handle_end_loop(parser); - } else if (tmp) { + } else if (tmp && !tmp->empty()) { const wcstring command = tmp.acquire(); data->update_buff_pos(&data->command_line, 0); data->command_line.clear(); data->command_line_changed(&data->command_line); wcstring_list_t argv(1, command); - if (!command.empty()) event_fire_generic(parser, L"fish_preexec", &argv); + event_fire_generic(parser, L"fish_preexec", &argv); reader_run_command(parser, command); parser.clear_cancel(); - if (!command.empty()) event_fire_generic(parser, L"fish_postexec", &argv); + 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();