Restore legacy CMD_DURATION and FISH_VERSION variables

Work on #4154.

Effectively reverts fb8ae04f80.

Discussed extensively in
https://github.com/fish-shell/fish-shell/pull/5320
This commit is contained in:
David Adam
2018-11-22 08:42:34 +08:00
parent ca46c556c3
commit 2dab869b41
3 changed files with 10 additions and 8 deletions

View File

@@ -78,7 +78,7 @@
// Name of the variable that tells how long it took, in milliseconds, for the previous
// interactive command to complete.
#define ENV_cmd_duration L"cmd_duration"
#define ENV_CMD_DURATION L"CMD_DURATION"
/// Maximum length of prefix string when printing completion list. Longer prefixes will be
/// ellipsized.
@@ -906,7 +906,7 @@ void reader_init() {
// 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.
env_set_one(ENV_cmd_duration, ENV_UNEXPORT, L"0");
env_set_one(ENV_CMD_DURATION, ENV_UNEXPORT, L"0");
// Save the initial terminal mode.
tcgetattr(STDIN_FILENO, &terminal_mode_on_startup);
@@ -2008,7 +2008,7 @@ void set_env_cmd_duration(struct timeval *after, struct timeval *before) {
}
swprintf(buf, 16, L"%d", (secs * 1000) + (usecs / 1000));
env_set_one(ENV_cmd_duration, ENV_UNEXPORT, buf);
env_set_one(ENV_CMD_DURATION, ENV_UNEXPORT, buf);
}
void reader_run_command(parser_t &parser, const wcstring &cmd) {