From 6f7c73b260dd8637f733d2099fab5a9fbf733467 Mon Sep 17 00:00:00 2001 From: Ariel Caplan Date: Wed, 15 Jan 2025 23:26:26 +0200 Subject: [PATCH] Write directly to stdout and stderr Certain versions of node add colors to console.warn and console.error which doesn't respect our control of colors via chalk. To avoid this kind of interference with the CLI, we should write directly to output streams. --- packages/cli-kit/src/public/node/output.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli-kit/src/public/node/output.ts b/packages/cli-kit/src/public/node/output.ts index 4f1ea228b2d..a35fdbdf1bb 100644 --- a/packages/cli-kit/src/public/node/output.ts +++ b/packages/cli-kit/src/public/node/output.ts @@ -371,7 +371,7 @@ export interface OutputProcess { * @param message - The message to print. */ export function consoleLog(message: string): void { - console.log(withOrWithoutStyle(message)) + process.stdout.write(withOrWithoutStyle(message)) } /** @@ -380,7 +380,7 @@ export function consoleLog(message: string): void { * @param message - The message to print. */ export function consoleError(message: string): void { - console.error(withOrWithoutStyle(message)) + process.stderr.write(withOrWithoutStyle(message)) } /** @@ -389,7 +389,7 @@ export function consoleError(message: string): void { * @param message - The message to print. */ export function consoleWarn(message: string): void { - console.warn(withOrWithoutStyle(message)) + process.stderr.write(withOrWithoutStyle(message)) } /**