Skip to content

Commit 21e69d1

Browse files
bzoztargos
authored andcommitted
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: #18478 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 441175c commit 21e69d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/parallel/test-tty-get-color-depth.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { WriteStream } = require('tty');
1010

1111
// Do our best to grab a tty fd.
1212
function getTTYfd() {
13-
const ttyFd = [0, 1, 2, 4, 5].find(tty.isatty);
13+
const ttyFd = [1, 2, 4, 5].find(tty.isatty);
1414
if (ttyFd === undefined) {
1515
try {
1616
return openSync('/dev/tty');

0 commit comments

Comments
 (0)