mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
c1fac11dfa
Closes #22229. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
24 lines
673 B
JavaScript
24 lines
673 B
JavaScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
import { internals, primordials } from "ext:core/mod.js";
|
|
import { op_console_size, op_is_terminal } from "ext:core/ops";
|
|
const {
|
|
Uint32Array,
|
|
} = primordials;
|
|
|
|
const size = new Uint32Array(2);
|
|
|
|
function consoleSize() {
|
|
op_console_size(size);
|
|
return { columns: size[0], rows: size[1] };
|
|
}
|
|
|
|
function isatty(rid) {
|
|
internals.warnOnDeprecatedApi(
|
|
"Deno.isatty()",
|
|
new Error().stack,
|
|
"Use `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()`, `Deno.stderr.isTerminal()` or `Deno.FsFile.isTerminal()` instead.",
|
|
);
|
|
return op_is_terminal(rid);
|
|
}
|
|
|
|
export { consoleSize, isatty };
|