Skip to content

Commit a24b175

Browse files
Perform an explicit return just in case sys.exit fails.
1 parent 81c4b0b commit a24b175

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/compiler/tc.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,32 +197,33 @@ module ts {
197197
// setting up localization, report them and quit.
198198
if (commandLine.errors.length > 0) {
199199
reportDiagnostics(commandLine.errors);
200-
sys.exit(1);
200+
return sys.exit(1);
201201
}
202202

203203
if (commandLine.options.version) {
204204
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Version_0, version));
205-
sys.exit(0);
205+
return sys.exit(0);
206206
}
207207

208208
if (commandLine.options.help || commandLine.filenames.length === 0) {
209209
printVersion();
210210
printHelp();
211-
sys.exit(0);
211+
return sys.exit(0);
212212
}
213213

214214
var defaultCompilerHost = createCompilerHost(commandLine.options);
215-
215+
216216
if (commandLine.options.watch) {
217217
if (!sys.watchFile) {
218218
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"));
219-
sys.exit(1);
219+
return sys.exit(1);
220220
}
221221

222222
watchProgram(commandLine, defaultCompilerHost);
223223
}
224224
else {
225-
sys.exit(compile(commandLine, defaultCompilerHost).errors.length > 0 ? 1 : 0);
225+
var result = compile(commandLine, defaultCompilerHost).errors.length > 0 ? 1 : 0;
226+
return sys.exit(result);
226227
}
227228
}
228229

0 commit comments

Comments
 (0)