Skip to content

Commit bdd5f6a

Browse files
committed
Ensured CLI exits if incorrect arguments are supplied
1 parent 319b93b commit bdd5f6a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Source/CommandLine.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,11 @@ static void performCommandLine (CommandLineValidator& validator, const ArgumentL
436436
"Runs the internal unit tests.", String(),
437437
[] (const auto&) { runUnitTests(); }});
438438

439-
JUCEApplication::getInstance()->setApplicationReturnValue (cli.findAndRunCommand (args));
439+
if (const auto retValue = cli.findAndRunCommand (args); retValue != 0)
440+
{
441+
JUCEApplication::getInstance()->setApplicationReturnValue (retValue);
442+
JUCEApplication::getInstance()->quit();
443+
}
440444

441445
// --validate runs async so will quit itself when done
442446
if (! args.containsOption ("--validate"))

0 commit comments

Comments
 (0)