test: fix test-tty-get-color-depth
If getTTYfd returns 0, and stdin is not writable (like on Windows), trying to create WriteStream will fail. This commit fixes that by skipping fd 0. PR-URL: https://github.com/nodejs/node/pull/18478 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
0c16b18043
commit
ef2861961c
@ -10,7 +10,7 @@ const { WriteStream } = require('tty');
|
||||
|
||||
// Do our best to grab a tty fd.
|
||||
function getTTYfd() {
|
||||
const ttyFd = [0, 1, 2, 4, 5].find(tty.isatty);
|
||||
const ttyFd = [1, 2, 4, 5].find(tty.isatty);
|
||||
if (ttyFd === undefined) {
|
||||
try {
|
||||
return openSync('/dev/tty');
|
||||
|
Loading…
x
Reference in New Issue
Block a user