-
Notifications
You must be signed in to change notification settings - Fork 6k
tty.isatty() reports wrong results for opened files #32995
Copy link
Copy link
Closed
Copy link
Labels
Description
The result seem to be correct for fd 0, 1 and 2 but wrong for files that are opened later.
The following sample shows how the results differ from node and bun:
$ cat test.js
var tty = require('node:tty');
var fs = require('node:fs');
console.log(tty.isatty(0));
console.log(tty.isatty(1));
console.log(tty.isatty(2));
var fd1 = fs.openSync('/dev/stdin', 'r')
var fd2 = fs.openSync('/dev/stdout', 'w')
var fd3 = fs.openSync('/dev/stderr', 'w')
console.log(tty.isatty(fd1));
console.log(tty.isatty(fd2));
console.log(tty.isatty(fd3));
$ ~/.deno/bin/deno --unstable-detect-cjs --allow-all test.js
true
true
true
false
false
false
$ node test.js
true
true
true
true
true
true
$ ~/.bun/bin/bun test.js
true
true
true
true
true
true
I noticed this while running the emscripten test suite under deno.
Reactions are currently unavailable