diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 12a1b09af54..6fce65c3f36 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -456,6 +456,7 @@ namespace ts { setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; clearTimeout?(timeoutId: any): void; clearScreen?(): void; + /*@internal*/ setBlocking?(): void; } export interface FileWatcher { @@ -614,6 +615,11 @@ namespace ts { clearTimeout, clearScreen: () => { process.stdout.write("\x1Bc"); + }, + setBlocking: () => { + if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) { + process.stdout._handle.setBlocking(true); + } } }; return nodeSystem; diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 3a340f049f8..04725cebabe 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -399,8 +399,9 @@ 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); + +if (ts.sys.setBlocking) { + ts.sys.setBlocking(); } + ts.executeCommandLine(ts.sys.args); diff --git a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter index ed149eb0c78..40bdb4eadab 160000 --- a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter +++ b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter @@ -1 +1 @@ -Subproject commit ed149eb0c787b1195a95b44105822c64bb6eb636 +Subproject commit 40bdb4eadabc9fbed7d83e3f26817a931c0763b6