diff --git a/toolsrc/org/mozilla/javascript/tools/shell/Main.java b/toolsrc/org/mozilla/javascript/tools/shell/Main.java index bc75a8c95b..25a219bed9 100644 --- a/toolsrc/org/mozilla/javascript/tools/shell/Main.java +++ b/toolsrc/org/mozilla/javascript/tools/shell/Main.java @@ -147,6 +147,9 @@ public static int exec(String origArgs[]) errorReporter = new ToolErrorReporter(false, global.getErr()); shellContextFactory.setErrorReporter(errorReporter); String[] args = processOptions(origArgs); + if (exitCode > 0) { + return exitCode; + } if (processStdin) { fileList.add(null); } @@ -394,7 +397,8 @@ public static String[] processOptions(String args[]) // print usage message global.getOut().println( ToolErrorReporter.getMessage("msg.shell.usage", Main.class.getName())); - System.exit(1); + exitCode = 1; + return null; } usageError = arg; break goodUsage; @@ -404,7 +408,7 @@ public static String[] processOptions(String args[]) ToolErrorReporter.getMessage("msg.shell.invalid", usageError)); global.getOut().println( ToolErrorReporter.getMessage("msg.shell.usage", Main.class.getName())); - System.exit(1); + exitCode = 1; return null; }