You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Parse errors for -c commands don't cause fish to return error #9888
> fish -c'begin'
fish: Missing end to balance this beginbegin^~~~^>echo$status
0
>echobegin| fish
fish: Missing end to balance this beginbegin^~~~^>echo$status
127
This should probably cause us to return an error code as well, and abort execution - in case there's multiple -c.
I'm not sure why we return 127 if it's piped, which is typically "command not found", but that's a separate thing.
Alright I did the simple, targeted fix. In particular we allow multiple -c commands, and we will continue on even if one failed - this is explicitly tested.
So this returns a failing status if the last-c command had a parser error, which is the typical case.
I don't love this - we typically stop for syntax errors early - we don't execute a file if it has a syntax error, and it feels weird to be so lax here.
I also don't love the 127 status, which was added in 6044ac7 as far as I can tell. But since that's the status we get here, that's what we'll return for consistency (note that the int return from run_command_list is, as far as I can tell, a lie - it's effectively a bool).
Activity
faho commentedon Jul 12, 2023
Alright I did the simple, targeted fix. In particular we allow multiple
-ccommands, and we will continue on even if one failed - this is explicitly tested.So this returns a failing status if the last
-ccommand had a parser error, which is the typical case.I don't love this - we typically stop for syntax errors early - we don't execute a file if it has a syntax error, and it feels weird to be so lax here.
I also don't love the 127 status, which was added in 6044ac7 as far as I can tell. But since that's the status we get here, that's what we'll return for consistency (note that the int return from run_command_list is, as far as I can tell, a lie - it's effectively a bool).
Return a falsey status if the last `-c` command has a parse error
Return a falsey status if the last `-c` command has a parse error