mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-23 16:51:16 -03:00
another step in fixing issue #3985
This changes all of the builtins to behave like `string` to return STATUS_INVALID_ARGS (121) if the args passed to the command don't make sense. Also change several of the builtins to use the existing symbols (e.g., STATUS_CMD_OK and STATUS_CMD_ERROR) rather than hardcoded "0" and "1" for consistency and to make it easier to find such values in the future. Fixes #3985
This commit is contained in:
@@ -591,7 +591,7 @@ bool combining_expression::evaluate(wcstring_list_t &errors) {
|
||||
}
|
||||
|
||||
errors.push_back(format_string(L"Unknown token type in %s", __func__));
|
||||
return STATUS_CMD_ERROR;
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
bool parenthetical_expression::evaluate(wcstring_list_t &errors) {
|
||||
@@ -741,7 +741,7 @@ int builtin_test(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
using namespace test_expressions;
|
||||
|
||||
// The first argument should be the name of the command ('test').
|
||||
if (!argv[0]) return STATUS_CMD_ERROR;
|
||||
if (!argv[0]) return STATUS_INVALID_ARGS;
|
||||
|
||||
// Whether we are invoked with bracket '[' or not.
|
||||
wchar_t *program_name = argv[0];
|
||||
@@ -758,7 +758,7 @@ int builtin_test(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
argc--;
|
||||
} else {
|
||||
streams.err.append(L"[: the last argument must be ']'\n");
|
||||
return STATUS_CMD_ERROR;
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user