Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/tty.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const {
let readline;

function isatty(fd) {
return NumberIsInteger(fd) && fd >= 0 && isTTY(fd);
return NumberIsInteger(fd) && fd >= 0 && fd <= 2147483647 &&
isTTY(fd);
}

function ReadStream(fd, options) {
Expand Down
1 change: 1 addition & 0 deletions test/pseudo-tty/test-tty-isatty.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ strictEqual(isatty(2), true, 'stderr reported to not be a tty, but it is');

strictEqual(isatty(-1), false, '-1 reported to be a tty, but it is not');
strictEqual(isatty(55555), false, '55555 reported to be a tty, but it is not');
strictEqual(isatty(2 ** 31), false, '2^31 reported to be a tty, but it is not');
strictEqual(isatty(1.1), false, '1.1 reported to be a tty, but it is not');
strictEqual(isatty('1'), false, '\'1\' reported to be a tty, but it is not');
strictEqual(isatty({}), false, '{} reported to be a tty, but it is not');
Expand Down