Skip to content

Commit

Permalink
test: fix test-tty-get-color-depth
Browse files Browse the repository at this point in the history
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 <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
bzoz authored and targos committed Mar 30, 2018
1 parent 441175c commit 21e69d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/parallel/test-tty-get-color-depth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 21e69d1

Please sign in to comment.