From fa9f071c1480288996ad0429fd94703acfb43972 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 25 Jun 2018 14:10:27 -0700 Subject: [PATCH] Don't try to write --pretty results to unsupported consoles in --build --- src/tsc/tsc.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 47d2c0b5c74..97e239c8bca 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -19,9 +19,13 @@ namespace ts { } } + function defaultIsPretty() { + return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY(); + } + function shouldBePretty(options: CompilerOptions) { if (typeof options.pretty === "undefined") { - return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY(); + return defaultIsPretty(); } return options.pretty; } @@ -50,7 +54,7 @@ namespace ts { export function executeCommandLine(args: string[]): void { if (args.length > 0 && ((args[0].toLowerCase() === "--build") || (args[0].toLowerCase() === "-b"))) { - const reportDiag = createDiagnosticReporter(sys, /*pretty*/ true); + const reportDiag = createDiagnosticReporter(sys, defaultIsPretty()); const report = (message: DiagnosticMessage, ...args: string[]) => reportDiag(createCompilerDiagnostic(message, ...args)); const buildHost: BuildHost = { error: report,