1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(ext/node): add WriteStream.isTTY (#21801)

This commit is contained in:
Divy Srivastava 2024-01-06 03:07:14 +05:30 committed by GitHub
parent 7c5c502773
commit dac9b6ab43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -3,6 +3,7 @@
import { assert } from "../../../test_util/std/assert/mod.ts";
import { isatty } from "node:tty";
import process from "node:process";
Deno.test("[node/tty isatty] returns true when fd is a tty, false otherwise", () => {
assert(Deno.isatty(Deno.stdin.rid) === isatty(Deno.stdin.rid));
@ -29,3 +30,8 @@ Deno.test("[node/tty isatty] returns false for irrelevant values", () => {
assert(!isatty(null as any));
assert(!isatty(undefined as any));
});
Deno.test("[node/tty WriteStream.isTTY] returns true when fd is a tty", () => {
assert(Deno.isatty(Deno.stdin.rid) === process.stdin.isTTY);
assert(Deno.isatty(Deno.stdout.rid) === process.stdout.isTTY);
});

View file

@ -79,6 +79,7 @@ export class WriteStream extends Socket {
const { columns, rows } = Deno.consoleSize();
this.columns = columns;
this.rows = rows;
this.isTTY = true;
}
}