Skip to content

Commit

Permalink
fix "color: false" in the js api
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed May 8, 2021
1 parent aaa0943 commit 2b0c26a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/shared/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function pushLogFlags(flags: string[], options: CommonOptions, keys: OptionKeys,
let logLevel = getFlag(options, keys, 'logLevel', mustBeString);
let logLimit = getFlag(options, keys, 'logLimit', mustBeInteger);

if (color) flags.push(`--color=${color}`);
if (color !== void 0) flags.push(`--color=${color}`);
else if (isTTY) flags.push(`--color=true`); // This is needed to fix "execFileSync" which buffers stderr
flags.push(`--log-level=${logLevel || logLevelDefault}`);
flags.push(`--log-limit=${logLimit || 0}`);
Expand Down

1 comment on commit 2b0c26a

@kzc
Copy link
Contributor

@kzc kzc commented on 2b0c26a May 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evanw There's a convention to not emit colors to tty if the environment variableNO_COLOR is set:

https://no-color.org

Rollup also supports it, although you wouldn't see colors in this github comment anyway...

$ NO_COLOR=1 rollup test.js

test.js → stdout...
console.log(2 );

It would nice if esbuild also supported this convention.

Please sign in to comment.