Add API to worker thread to check whether main thread is TTY
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
What is the problem this feature will solve?
In worker threads, process.stdout.isTTY and process.stderr.isTTY are undefined. However, they do forward stdout/stderr to the main thread, and the main thread could potentially be isTTY === 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: https://github.com/nodejs/node/issues/26946
What alternatives have you considered?
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia leggendo l’API worker_threads e la issue correlata #26946, quindi traccia il comportamento di process.stdout.isTTY e process.stderr.isTTY quando l’output viene inoltrato da un worker. Il lavoro è completato quando l’API proposta per i worker thread può rilevare lo stato TTY di stdout e stderr del thread principale e copre il caso d’uso di color-package.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- backend-api-design
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100