From ef13d8f33aad33e6eb3fcc5986791d8d439a76e4 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Thu, 10 Sep 2020 08:32:00 -0700 Subject: [PATCH] fix(dev-infra): remove ANSI escape codes from log file outputs (#38792) Remove the ANSI codes from the log file outputs to make the ng-dev log files more readable. PR Close #38792 --- dev-infra/utils/console.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev-infra/utils/console.ts b/dev-infra/utils/console.ts index e4e02563346b7..58aa5feeea88e 100644 --- a/dev-infra/utils/console.ts +++ b/dev-infra/utils/console.ts @@ -196,6 +196,9 @@ export function captureLogOutputForCommand(argv: Arguments) { /** Path to the log file location. */ const logFilePath = join(getRepoBaseDir(), '.ng-dev.log'); + // Strip ANSI escape codes from log outputs. + LOGGED_TEXT = LOGGED_TEXT.replace(/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]/g, ''); + writeFileSync(logFilePath, LOGGED_TEXT); // For failure codes greater than 1, the new logged lines should be written to a specific log