Skip to content

Commit

Permalink
Write directly to stdout and stderr
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
amcaplan committed Jan 15, 2025
1 parent 3c10c59 commit 6f7c73b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/cli-kit/src/public/node/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

/**
Expand All @@ -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))
}

/**
Expand All @@ -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))
}

/**
Expand Down

0 comments on commit 6f7c73b

Please sign in to comment.