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:
parent
7c5c502773
commit
dac9b6ab43
2 changed files with 7 additions and 0 deletions
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -79,6 +79,7 @@ export class WriteStream extends Socket {
|
|||
const { columns, rows } = Deno.consoleSize();
|
||||
this.columns = columns;
|
||||
this.rows = rows;
|
||||
this.isTTY = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue