1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +00: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:
Linus Groh 2020-05-16 19:43:21 +01:00 committed by Andreas Kling
parent 5ee79e6657
commit b11c7ad2ba

View file

@ -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;