From 9b8be7c09e63bf2fb180b3f2eaaa2f6cc9a8fecc Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Wed, 4 Sep 2019 14:35:30 -0700 Subject: [PATCH] Cherry-pick PR #33141 into release-3.6 (#33247) Component commits: 206de25263 Ensure that TS can run in a browser by checking for a process obj before using it in the perf logger 45227ee337 Merge branch 'master' into allow_running_in_web --- src/compiler/perfLogger.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/perfLogger.ts b/src/compiler/perfLogger.ts index 5696a97ad423d..93ff0bf89dd1b 100644 --- a/src/compiler/perfLogger.ts +++ b/src/compiler/perfLogger.ts @@ -38,6 +38,6 @@ namespace ts { /** Performance logger that will generate ETW events if possible - check for `logEvent` member, as `etwModule` will be `{}` when browserified */ export const perfLogger: PerfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger; - - perfLogger.logInfoEvent(`Starting TypeScript v${versionMajorMinor} with command line: ${JSON.stringify(process.argv)}`); + const args = typeof process === "undefined" ? [] : process.argv; + perfLogger.logInfoEvent(`Starting TypeScript v${versionMajorMinor} with command line: ${JSON.stringify(args)}`); }