-
Notifications
You must be signed in to change notification settings - Fork 31.3k
Add API to worker thread to check whether main thread is TTY #51750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
would a solution like explicity setting in the worker options |
That doesn't work for my use-case, where a package needs this. The package has no control over the worker creation. |
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-stale
|
Please keep this open. |
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-stale
|
Please keep this open. |
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: