From b11c7ad2bad9fc3ef006d4745ef86f78257653ca Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 16 May 2020 19:43:21 +0100 Subject: [PATCH] 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 - 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. --- Shell/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Shell/main.cpp b/Shell/main.cpp index 2f562c0a3d..14c06c9187 100644 --- a/Shell/main.cpp +++ b/Shell/main.cpp @@ -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;