From ef2861961c3d9e9ed6972e1e84d969683b25cf95 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Wed, 31 Jan 2018 16:48:21 +0100 Subject: [PATCH] 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 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- test/parallel/test-tty-get-color-depth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-tty-get-color-depth.js b/test/parallel/test-tty-get-color-depth.js index a5a998b6a3a..a4c7ffacd17 100644 --- a/test/parallel/test-tty-get-color-depth.js +++ b/test/parallel/test-tty-get-color-depth.js @@ -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');