From a24b175586c841b25a8ea195c572ad347f8f027d Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 5 Aug 2014 12:51:17 -0700 Subject: [PATCH] Perform an explicit return just in case sys.exit fails. --- src/compiler/tc.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/compiler/tc.ts b/src/compiler/tc.ts index 77caacbe149..5009e4c7a97 100644 --- a/src/compiler/tc.ts +++ b/src/compiler/tc.ts @@ -197,32 +197,33 @@ module ts { // setting up localization, report them and quit. if (commandLine.errors.length > 0) { reportDiagnostics(commandLine.errors); - sys.exit(1); + return sys.exit(1); } if (commandLine.options.version) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.Version_0, version)); - sys.exit(0); + return sys.exit(0); } if (commandLine.options.help || commandLine.filenames.length === 0) { printVersion(); printHelp(); - sys.exit(0); + return sys.exit(0); } var defaultCompilerHost = createCompilerHost(commandLine.options); - + if (commandLine.options.watch) { if (!sys.watchFile) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); - sys.exit(1); + return sys.exit(1); } watchProgram(commandLine, defaultCompilerHost); } else { - sys.exit(compile(commandLine, defaultCompilerHost).errors.length > 0 ? 1 : 0); + var result = compile(commandLine, defaultCompilerHost).errors.length > 0 ? 1 : 0; + return sys.exit(result); } }