Skip to content

Commit fa9f071

Browse files
committed
Don't try to write --pretty results to unsupported consoles in --build
1 parent d474603 commit fa9f071

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/tsc/tsc.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ namespace ts {
1919
}
2020
}
2121

22+
function defaultIsPretty() {
23+
return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY();
24+
}
25+
2226
function shouldBePretty(options: CompilerOptions) {
2327
if (typeof options.pretty === "undefined") {
24-
return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY();
28+
return defaultIsPretty();
2529
}
2630
return options.pretty;
2731
}
@@ -50,7 +54,7 @@ namespace ts {
5054

5155
export function executeCommandLine(args: string[]): void {
5256
if (args.length > 0 && ((args[0].toLowerCase() === "--build") || (args[0].toLowerCase() === "-b"))) {
53-
const reportDiag = createDiagnosticReporter(sys, /*pretty*/ true);
57+
const reportDiag = createDiagnosticReporter(sys, defaultIsPretty());
5458
const report = (message: DiagnosticMessage, ...args: string[]) => reportDiag(createCompilerDiagnostic(message, ...args));
5559
const buildHost: BuildHost = {
5660
error: report,

0 commit comments

Comments
 (0)