From a81f264d70586bcfaf2d3350010198d04ead3be5 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 8 Mar 2018 12:38:30 -0800 Subject: [PATCH] Call process.stdout._handle.setBlocking(true) (#22389) * Call process.stdout._handle.setBlocking(true) This prevents output from being truncated when the compiler can output errors to stdout faster than it can receive them. This may slow down performance for compilations for many errors, but those were already quite slow. * Disable tslint no-unnnecessary-type-assertion-2 It is wrong. It *is* necessary. --- src/compiler/tsc.ts | 4 ++++ src/server/server.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 245d5c2219c..3a340f049f8 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -399,4 +399,8 @@ if (ts.Debug.isDebugging) { if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) { ts.sys.tryEnableSourceMapsForHost(); } +declare var process: any; +if (process && process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) { + process.stdout._handle.setBlocking(true); +} ts.executeCommandLine(ts.sys.args); diff --git a/src/server/server.ts b/src/server/server.ts index f70280c34a3..2529008c165 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -991,6 +991,7 @@ namespace ts.server { ioSession.logError(err, "unknown"); }); // See https://github.com/Microsoft/TypeScript/issues/11348 + // tslint:disable-next-line no-unnecessary-type-assertion-2 (process as any).noAsar = true; // Start listening ioSession.listen();