worker: propagate TTY color support - #65776
Open
kiliczsh wants to merge 2 commits into
Open
Conversation
kiliczsh
force-pushed
the
fix-worker-styletext-colors
branch
from
September 4, 2026 07:40
976abd0 to
4319228
Compare
Propagate parent stdout and stderr TTY state to workers that use default stdio handling. This allows styleText() to detect color support inside workers. Keep captured worker output unstyled because its eventual destination is unknown. Fixes: nodejs#65766 Signed-off-by: Muhammed Kılıç <[email protected]>
kiliczsh
force-pushed
the
fix-worker-styletext-colors
branch
from
September 4, 2026 07:42
4319228 to
182c1fb
Compare
Cover stdout, stderr, captured streams, and non-TTY parent output. Fixes: nodejs#65766 Signed-off-by: Muhammed Kılıç <[email protected]>
Author
|
I pushed a follow-up commit that expands the regression coverage. The test now covers:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65776 +/- ##
==========================================
- Coverage 90.06% 90.05% -0.02%
==========================================
Files 769 769
Lines 261321 261430 +109
Branches 49625 49638 +13
==========================================
+ Hits 235369 235439 +70
- Misses 16994 17031 +37
- Partials 8958 8960 +2
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #65766
Description
util.styleText()checks the target stream to determine whether colors aresupported. In a worker, the default
process.stdoutandprocess.stderrareworker stdio wrappers that do not expose the TTY color capabilities of the
parent destination. As a result,
styleText()omits ANSI styling even when theworker output is forwarded to a color-capable terminal.
This change propagates the parent stdout and stderr TTY state when a worker is
created with the default stdio handling. The worker then exposes the relevant
TTY color methods on its stdio wrapper, allowing
styleText()to perform itsnormal color-support check.
Workers created with
stdout: trueorstderr: truedo not inherit thecorresponding TTY state. Their output is captured and its eventual destination
is unknown, so color is not enabled automatically in that case.
Testing
Added a regression test covering both cases:
stdout: true.The following targeted tests pass on Windows:
Note: A broader
test/parallelrun completed with 4,845 passing tests and fiveenvironment-related failures. None of those failures involved worker stdio or
styleText().AI assistance was used while investigating the issue and preparing the change.
The code and tests were reviewed and verified by @kiliczsh(me).