-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously, various inputs other than non-negative integers would produce incorrect results. Added type-checking on input, returning false for anything other than non-negative integers. Also clarified in docs. PR-URL: #15567 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
- Loading branch information
1 parent
c4edcfd
commit 38028c6
Showing
4 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const { strictEqual } = require('assert'); | ||
const { isatty } = require('tty'); | ||
|
||
strictEqual(isatty(0), true, 'stdin reported to not be a tty, but it is'); | ||
strictEqual(isatty(1), true, 'stdout reported to not be a tty, but it is'); | ||
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(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'); | ||
strictEqual(isatty(() => {}), false, | ||
'() => {} reported to be a tty, but it is not'); |
Empty file.