Repository navigation
Commit 9229f1f
committed
lib: respect stream.isTTY=false in styleText even when FORCE_COLOR is set
When FORCE_COLOR is set (e.g. by
ode --test, which injects it into
child-process environments to colorize test output), the shouldColorize()
helper in lib/internal/util/colors.js was ignoring the isTTY property of
the stream argument entirely. This caused util.styleText() to apply ANSI
codes to streams that were explicitly marked as non-TTY by the caller.
Fix: if a stream is supplied and its isTTY property is explicitly false,
return false even when FORCE_COLOR is set. FORCE_COLOR is intended to
force color support in terminals that lie about their capabilities; it
should not override an explicit isTTY=false on a caller-supplied stream.
Fixes: #57921
Signed-off-by: piyushrajyadav <piyushyadavrajyadav@gmail.com>1 parent 7b6b21a commit 9229f1f
2 files changed
Lines changed: 43 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
203 | 206 | | |
204 | 207 | | |
205 | 208 | | |
| |||
221 | 224 | | |
222 | 225 | | |
223 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
0 commit comments