summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tsc/dts/lib.deno.ns.d.ts19
-rw-r--r--runtime/js/40_tty.js9
-rw-r--r--tests/unit/tty_test.ts2
3 files changed, 5 insertions, 25 deletions
diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts
index 8ba41eae0..e861b876e 100644
--- a/cli/tsc/dts/lib.deno.ns.d.ts
+++ b/cli/tsc/dts/lib.deno.ns.d.ts
@@ -2876,25 +2876,6 @@ declare namespace Deno {
}
/**
- * Check if a given resource id (`rid`) is a TTY (a terminal).
- *
- * ```ts
- * // This example is system and context specific
- * const nonTTYRid = Deno.openSync("my_file.txt").rid;
- * const ttyRid = Deno.openSync("/dev/tty6").rid;
- * console.log(Deno.isatty(nonTTYRid)); // false
- * console.log(Deno.isatty(ttyRid)); // true
- * ```
- *
- * @deprecated This will be soft-removed in Deno 2.0. See the
- * {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
- * for migration instructions.
- *
- * @category I/O
- */
- export function isatty(rid: number): boolean;
-
- /**
* A variable-sized buffer of bytes with `read()` and `write()` methods.
*
* @deprecated This will be removed in Deno 2.0. See the
diff --git a/runtime/js/40_tty.js b/runtime/js/40_tty.js
index 7cf1e4f5d..72e7b6884 100644
--- a/runtime/js/40_tty.js
+++ b/runtime/js/40_tty.js
@@ -1,5 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
-import { core, internals, primordials } from "ext:core/mod.js";
+import { core, primordials } from "ext:core/mod.js";
import { op_console_size } from "ext:core/ops";
const {
Uint32Array,
@@ -15,12 +15,9 @@ function consoleSize() {
return { columns: size[0], rows: size[1] };
}
+// Note: This function was soft-removed in Deno 2. Its types have been removed,
+// but its implementation has been kept to avoid breaking changes.
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 isTerminal(rid);
}
diff --git a/tests/unit/tty_test.ts b/tests/unit/tty_test.ts
index 35e7dd783..4183fe530 100644
--- a/tests/unit/tty_test.ts
+++ b/tests/unit/tty_test.ts
@@ -20,6 +20,7 @@ Deno.test(
function isatty() {
// CI not under TTY, so cannot test stdin/stdout/stderr.
const f = Deno.openSync("tests/testdata/assets/hello.txt");
+ // @ts-ignore `Deno.isatty()` was soft-removed in Deno 2.
assert(!Deno.isatty(f.rid));
f.close();
},
@@ -29,6 +30,7 @@ Deno.test(function isattyError() {
let caught = false;
try {
// Absurdly large rid.
+ // @ts-ignore `Deno.isatty()` was soft-removed in Deno 2.
Deno.isatty(0x7fffffff);
} catch (e) {
caught = true;