mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 06:41:14 -03:00
parse_util: Only reject time in a pipeline without decorator
This allows e.g. `foo | command time`, while still rejecting `foo | time`. (this should really be done in the ast itself, but tbh most of parse_util kinda should) Fixes #9985
This commit is contained in:
@@ -961,8 +961,16 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src,
|
||||
|
||||
// Similarly for time (#8841).
|
||||
if (command == L"time") {
|
||||
errored = append_syntax_error(parse_errors, source_start, source_length,
|
||||
TIME_IN_PIPELINE_ERR_MSG);
|
||||
// We only reject it if we have no decoration.
|
||||
// `echo foo | command time something`
|
||||
// is entirely fair and valid.
|
||||
// Other current decorations like "exec"
|
||||
// are already forbidden.
|
||||
const auto &deco = dst.decoration();
|
||||
if (deco == statement_decoration_t::none) {
|
||||
errored = append_syntax_error(parse_errors, source_start, source_length,
|
||||
TIME_IN_PIPELINE_ERR_MSG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user