mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-24 01:11:15 -03:00
Fix status code when bad command name is entered
This commit fixes a bug which causes that
fish -c ')'; echo $status
("Illegal command name" error) returns 0. This is inconsistent with
e.g. when trying to run non-existent command:
fish -c 'invalid-command'; echo $status
("Unknown command" error) which correctly returns 127.
A new status code,
STATUS_ILLEGAL_CMD = 123
is introduced - which is returned whenever the 'Illegal command name *'
message is printed.
This commit also adds a test which checks if valid commands return 0,
while commands with illegal name return status code 123.
Fixes #3606.
This commit is contained in:
committed by
ridiculousfish
parent
bf53f39cdd
commit
254762f30f
@@ -832,6 +832,7 @@ parse_execution_result_t parse_execution_context_t::populate_plain_process(
|
||||
bool expanded = expand_one(cmd, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES, NULL);
|
||||
if (!expanded) {
|
||||
report_error(statement, ILLEGAL_CMD_ERR_MSG, cmd.c_str());
|
||||
proc_set_last_status(STATUS_ILLEGAL_CMD);
|
||||
return parse_execution_errored;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user