Merge pull request #22512 from Microsoft/fixUseOfProcess

Do not use unguarded process in tsc.ts
This commit is contained in:
Mohamed Hegazy 2018-03-13 11:24:31 -07:00 committed by GitHub
commit 85df31cde4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -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;

View File

@ -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);

@ -1 +1 @@
Subproject commit ed149eb0c787b1195a95b44105822c64bb6eb636
Subproject commit 40bdb4eadabc9fbed7d83e3f26817a931c0763b6