Uh oh!
There was an error while loading. Please reload this page.
lib: support FORCE_COLOR for non TTY streams - #48034
Conversation
nodejs-github-bot
commented
May 16, 2023
Review requested:
|
There was a problem hiding this comment.
tests did not play well when running in parallel. used node:test to run them sequentially
MoLow
commented
May 16, 2023
/CC @nodejs/util @nodejs/console |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
May 17, 2023
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
nodejs-github-bot
commented
May 17, 2023
PR-URL: #48034 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
danielleadams
commented
Jul 5, 2023
This broke tests when pulling into v18, so it needs a backport. |
MoLow
commented
Jul 6, 2023
@danielleadams It seems |
danielleadams
commented
Jul 6, 2023
Talked to @MoLow offline, but staging branch is ready for backport now. |
PR-URL: nodejs#48034 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: nodejs#48034 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
addaleax
commented
Jan 22, 2024
@MoLow Small heads up, this seems to have broken |
MoLow
commented
Jan 23, 2024
@addaleax I am not able to reproduce this: |
addaleax
commented
Jan 23, 2024
@MoLow Yeah, |
This was historically done to make `console.log()` have colors. However, this makes any other code that checks `process.stdout.isTTY` incorrectly assume real TTY support. Node18 and Node20 now respect `FORCE_COLOR=1` in console, so our default behavior of forcing colors in the worker process just works out of the box. See nodejs/node#48034.

The current behavior of
FORCE_COLORis to take effect whenstdout/stderrare TTY'saccording to the documentation:
this PR moves the check for the value of
FORCE_COLORbefore testingisTTY- and extracts the logic to a central utility.Refs: #31409 (comment)