Add API to worker thread to check whether main thread is TTY #51750
Labels
feature request
Issues that request new features to be added to Node.js.
worker
Issues and PRs related to Worker support.
What is the problem this feature will solve?
In worker threads,
process.stdout.isTTY
andprocess.stderr.isTTY
areundefined
. However, they do forward stdout/stderr to the main thread, and the main thread could potentially beisTTY === true
. This makes sense as some things don't work, like raw mode. However, things that produce colors would want to be able to detect that the main thread is TTY, so colors can be shown when logged from a worker thread.What is the feature you are proposing to solve the problem?
Add an API to worker threads to check whether stdout/stderr in the main thread is TTY.
This is needed for color packages like
chalk
to be able to support showing colors when running in worker threads.Relevant issue: #26946
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: