diff --git a/src/env.cpp b/src/env.cpp index 1a2b3e245..a5d9b8f75 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -347,6 +347,11 @@ void env_init(const struct config_paths_t *paths, bool do_uvars, bool default_pa // Set up $IFS - this used to be in share/config.fish, but really breaks if it isn't done. vars.set_one(L"IFS", ENV_GLOBAL, L"\n \t"); + // Ensure this var is present even before an interactive command is run so that if it is used + // in a function like `fish_prompt` or `fish_right_prompt` it is defined at the time the first + // prompt is written. + vars.set_one(L"CMD_DURATION", ENV_UNEXPORT, L"0"); + // Set up the version variable. wcstring version = str2wcstring(get_fish_version()); vars.set_one(L"version", ENV_GLOBAL, version); diff --git a/src/reader.cpp b/src/reader.cpp index 72ba6cefb..4fef7c104 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1391,13 +1391,6 @@ void reader_data_t::exec_prompt() { } void reader_init() { - auto &vars = parser_t::principal_parser().vars(); - - // Ensure this var is present even before an interactive command is run so that if it is used - // in a function like `fish_prompt` or `fish_right_prompt` it is defined at the time the first - // prompt is written. - vars.set_one(ENV_CMD_DURATION, ENV_UNEXPORT, L"0"); - // Save the initial terminal mode. tcgetattr(STDIN_FILENO, &terminal_mode_on_startup);