mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 10:01:14 -03:00
Migrate initializing CMD_DURATION from reader to env
This puts the initialization of CMD_DURATION at home with other default-initialized variables. No user-visible change expected from this.
This commit is contained in:
@@ -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.
|
// 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");
|
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.
|
// Set up the version variable.
|
||||||
wcstring version = str2wcstring(get_fish_version());
|
wcstring version = str2wcstring(get_fish_version());
|
||||||
vars.set_one(L"version", ENV_GLOBAL, version);
|
vars.set_one(L"version", ENV_GLOBAL, version);
|
||||||
|
|||||||
@@ -1391,13 +1391,6 @@ void reader_data_t::exec_prompt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void reader_init() {
|
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.
|
// Save the initial terminal mode.
|
||||||
tcgetattr(STDIN_FILENO, &terminal_mode_on_startup);
|
tcgetattr(STDIN_FILENO, &terminal_mode_on_startup);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user