mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
Shell: Properly handle parser syntax errors
In the case of a syntax error the shell parser prints an error message to stderr and returns an empty Vector<Command> - in that case we shouldn't try to determine whether or not we can continue parsing but abort immediately - is_complete() expects that *something* was parsed successfully. Fixes #2251.
This commit is contained in:
parent
5ee79e6657
commit
b11c7ad2ba
Notes:
sideshowbarker
2024-07-19 06:36:20 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/b11c7ad2bad Pull-request: https://github.com/SerenityOS/serenity/pull/2255 Issue: https://github.com/SerenityOS/serenity/issues/2251
1 changed files with 3 additions and 0 deletions
|
@ -857,6 +857,9 @@ static ExitCodeOrContinuationRequest run_command(const StringView& cmd)
|
|||
|
||||
auto commands = Parser(cmd).parse();
|
||||
|
||||
if (!commands.size())
|
||||
return 1;
|
||||
|
||||
auto needs_more = is_complete(commands);
|
||||
if (needs_more != ExitCodeOrContinuationRequest::Nothing)
|
||||
return needs_more;
|
||||
|
|
Loading…
Add table
Reference in a new issue