mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Better errors when calling a command in a command substitution fails
This commit is contained in:
parent
04f1254c94
commit
c95a223f5e
3 changed files with 28 additions and 1 deletions
|
@ -20,7 +20,8 @@ Scripting improvements
|
|||
- ``echo`` no longer writes its output one byte at a time, improving performance and allowing use with linux' special API files (``/proc``, ``/sys`` and such) (:issue:`7836`).
|
||||
- fish should now better handle ``cd`` on filesystems with broken ``stat(3)`` responses (:issue:`7577`).
|
||||
- Builtins now properly report a ``$status`` of 1 upon unsuccessful writes (:issue:`7857`).
|
||||
- `string match` with unmatched capture groups and without the `--all` flag now sets an empty variable instead of a variable containing the empty string, matching the documentation.
|
||||
- ``string match`` with unmatched capture groups and without the ``--all`` flag now sets an empty variable instead of a variable containing the empty string, matching the documentation.
|
||||
- Better errors when a command in a command substitution wasn't found or is not allowed.
|
||||
|
||||
Interactive improvements
|
||||
-------------------------
|
||||
|
|
|
@ -652,6 +652,15 @@ static expand_result_t expand_cmdsubst(wcstring input, const operation_context_t
|
|||
case STATUS_CMD_ERROR:
|
||||
err = L"Too many active file descriptors";
|
||||
break;
|
||||
case STATUS_CMD_UNKNOWN:
|
||||
err = L"Unknown command";
|
||||
break;
|
||||
case STATUS_ILLEGAL_CMD:
|
||||
err = L"Commandname was invalid";
|
||||
break;
|
||||
case STATUS_NOT_EXECUTABLE:
|
||||
err = L"Command not executable";
|
||||
break;
|
||||
default:
|
||||
err = L"Unknown error while evaluating command substitution";
|
||||
break;
|
||||
|
|
|
@ -100,3 +100,20 @@ switch $smurf
|
|||
echo Test 3 pass
|
||||
end
|
||||
#CHECK: Test 3 pass
|
||||
|
||||
begin
|
||||
set -l PATH
|
||||
switch (doesnotexist)
|
||||
case '*'
|
||||
echo Matched!
|
||||
end
|
||||
# CHECKERR: fish: Unknown command: doesnotexist
|
||||
# CHECKERR: checks/switch.fish (line {{\d+}}):
|
||||
# CHECKERR: doesnotexist
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: in command substitution
|
||||
# CHECKERR: {{\t}}called on line {{\d+}} of file checks/switch.fish
|
||||
# CHECKERR: checks/switch.fish (line {{\d+}}): Unknown command
|
||||
# CHECKERR: switch (doesnotexist)
|
||||
# CHECKERR: ^
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue