From 26949fa865af468d3f86d528cd2e43925fe9d202 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 23 Feb 2020 23:42:31 +0100 Subject: [PATCH] List time as builtin, support time --help `a=b time foo` will no longer call an external `time` command (like it does in bash). Fixes #6598 (cherry picked from commit 7ef7f93a90f4dbc0df0c05b3852b264395d40409) --- src/builtin.cpp | 1 + src/parse_productions.cpp | 14 +++++--------- tests/checks/time.fish | 6 ------ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/builtin.cpp b/src/builtin.cpp index cf4bb57ec..4e676f3a4 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -394,6 +394,7 @@ static const builtin_data_t builtin_datas[] = { {L"string", &builtin_string, N_(L"Manipulate strings")}, {L"switch", &builtin_generic, N_(L"Conditionally execute a block of commands")}, {L"test", &builtin_test, N_(L"Test a condition")}, + {L"time", &builtin_generic, N_(L"Measure how long a command or block takes")}, {L"true", &builtin_true, N_(L"Return a successful result")}, {L"ulimit", &builtin_ulimit, N_(L"Set or get the shells resource usage limits")}, {L"wait", &builtin_wait, N_(L"Wait for background processes completed")}, diff --git a/src/parse_productions.cpp b/src/parse_productions.cpp index 9584ee096..b52f1cfe8 100644 --- a/src/parse_productions.cpp +++ b/src/parse_productions.cpp @@ -397,16 +397,12 @@ RESOLVE(optional_background) { } RESOLVE(optional_time) { - UNUSED(token2); - - switch (token1.keyword) { - case parse_keyword_time: - *out_tag = parse_optional_time_time; - return production_for