protected virtual int RunCommandLine(OptionsParser optionsParser) { Contract.RequiresNotNull(optionsParser, "optionsParser"); CommandLine command_line; ConsoleOptions console_options; EngineOptions engine_options; console_options = optionsParser.ConsoleOptions; engine_options = optionsParser.EngineOptions; command_line = _options.LanguageProvider.GetCommandLine(); IScriptEngine engine = _options.LanguageProvider.GetEngine(engine_options); if (console_options.PrintVersionAndExit) { Console.WriteLine(engine.VersionString); return(0); } if (console_options.PrintUsageAndExit) { if (optionsParser != null) { PrintLanguageHelp(_options.LanguageProvider, Console.Out); } return(0); } engine.SetSourceUnitSearchPaths(_options.SourceUnitSearchPaths); IConsole console = _options.LanguageProvider.GetConsole(command_line, engine, console_options); console_options.RemainingArgs = _options.IgnoredArgs.ToArray(); int result; if (console_options.HandleExceptions) { try { result = command_line.Run(engine, console, console_options); } catch (Exception e) { UnhandledException(engine, e); result = 1; } ScriptEngine se = engine as ScriptEngine; if (se != null) { try { se.DumpDebugInfo(); } catch { result = 1; } } return(result); } else { try { return(command_line.Run(engine, console, console_options)); } finally { ScriptEngine se = engine as ScriptEngine; if (se != null) { se.DumpDebugInfo(); } } } }