From 65a760528ada1dbff6517a6a838d461d6c6050c4 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 15 Feb 2021 18:59:54 +0100 Subject: [PATCH] Skip figuring out config with --no-execute Cuts the time to check all our fish scripts in the check-all-fish-files.fish test roughly in half, from 3.3s to 1.8s. --- src/fish.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/fish.cpp b/src/fish.cpp index b601cba8c..ed0c643bb 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -465,8 +465,12 @@ int main(int argc, char **argv) { save_term_foreground_process_group(); } - const struct config_paths_t paths = determine_config_directory_paths(argv[0]); - env_init(&paths); + struct config_paths_t paths; + // If we're not executing, there's no need to find the config. + if (!opts.no_exec) { + paths = determine_config_directory_paths(argv[0]); + env_init(&paths); + } // Set features early in case other initialization depends on them. // Start with the ones set in the environment, then those set on the command line (so the @@ -484,7 +488,9 @@ int main(int argc, char **argv) { parser_t &parser = parser_t::principal_parser(); - read_init(parser, paths); + if (!opts.no_exec) { + read_init(parser, paths); + } // Stomp the exit status of any initialization commands (issue #635). parser.set_last_statuses(statuses_t::just(STATUS_CMD_OK));