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

chore: soft-remove Deno.{stdin,stderr,stdout}.rid (#25479)

Towards #22079
This commit is contained in:
Asher Gomez 2024-09-07 08:37:35 +10:00 committed by GitHub
parent 292344af42
commit 5bac4075c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 46 deletions

View file

@ -2468,15 +2468,6 @@ declare namespace Deno {
* @category I/O
*/
export const stdin: Reader & ReaderSync & Closer & {
/**
* The resource ID assigned to `stdin`. This can be used with the discrete
* I/O functions in the `Deno` namespace.
*
* @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.
*/
readonly rid: number;
/** A readable stream interface to `stdin`. */
readonly readable: ReadableStream<Uint8Array>;
/**
@ -2516,15 +2507,6 @@ declare namespace Deno {
* @category I/O
*/
export const stdout: Writer & WriterSync & Closer & {
/**
* The resource ID assigned to `stdout`. This can be used with the discrete
* I/O functions in the `Deno` namespace.
*
* @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.
*/
readonly rid: number;
/** A writable stream interface to `stdout`. */
readonly writable: WritableStream<Uint8Array>;
/**
@ -2550,15 +2532,6 @@ declare namespace Deno {
* @category I/O
*/
export const stderr: Writer & WriterSync & Closer & {
/**
* The resource ID assigned to `stderr`. This can be used with the discrete
* I/O functions in the `Deno` namespace.
*
* @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.
*/
readonly rid: number;
/** A writable stream interface to `stderr`. */
readonly writable: WritableStream<Uint8Array>;
/**

View file

@ -4,7 +4,7 @@
// Documentation liberally lifted from them too.
// Thank you! We love Go! <3
import { core, internals, primordials } from "ext:core/mod.js";
import { core, primordials } from "ext:core/mod.js";
import { op_set_raw } from "ext:core/ops";
const {
Uint8Array,
@ -121,11 +121,6 @@ class Stdin {
}
get rid() {
internals.warnOnDeprecatedApi(
"Deno.stdin.rid",
new Error().stack,
"Use `Deno.stdin` instance methods instead.",
);
return this.#rid;
}
@ -186,11 +181,6 @@ class Stdout {
}
get rid() {
internals.warnOnDeprecatedApi(
"Deno.stdout.rid",
new Error().stack,
"Use `Deno.stdout` instance methods instead.",
);
return this.#rid;
}
@ -226,11 +216,6 @@ class Stderr {
}
get rid() {
internals.warnOnDeprecatedApi(
"Deno.stderr.rid",
new Error().stack,
"Use `Deno.stderr` instance methods instead.",
);
return this.#rid;
}

View file

@ -12,8 +12,11 @@ import { copy } from "@std/io/copy";
// Note tests for Deno.FsFile.setRaw is in integration tests.
Deno.test(function filesStdioFileDescriptors() {
// @ts-ignore `Deno.stdin.rid` was soft-removed in Deno 2.
assertEquals(Deno.stdin.rid, 0);
// @ts-ignore `Deno.stdout.rid` was soft-removed in Deno 2.
assertEquals(Deno.stdout.rid, 1);
// @ts-ignore `Deno.stderr.rid` was soft-removed in Deno 2.
assertEquals(Deno.stderr.rid, 2);
});

View file

@ -461,6 +461,7 @@ Deno.test({
Deno.test({
name: "process.stdin",
fn() {
// @ts-ignore `Deno.stdin.rid` was soft-removed in Deno 2.
assertEquals(process.stdin.fd, Deno.stdin.rid);
assertEquals(process.stdin.isTTY, Deno.stdin.isTerminal());
},
@ -640,6 +641,7 @@ Deno.test({
Deno.test({
name: "process.stdout",
fn() {
// @ts-ignore `Deno.stdout.rid` was soft-removed in Deno 2.
assertEquals(process.stdout.fd, Deno.stdout.rid);
const isTTY = Deno.stdout.isTerminal();
assertEquals(process.stdout.isTTY, isTTY);
@ -668,6 +670,7 @@ Deno.test({
Deno.test({
name: "process.stderr",
fn() {
// @ts-ignore `Deno.stderr.rid` was soft-removed in Deno 2.
assertEquals(process.stderr.fd, Deno.stderr.rid);
const isTTY = Deno.stderr.isTerminal();
assertEquals(process.stderr.isTTY, isTTY);

View file

@ -7,9 +7,9 @@ import tty from "node:tty";
import process from "node:process";
Deno.test("[node/tty isatty] returns true when fd is a tty, false otherwise", () => {
assert(Deno.stdin.isTerminal() === isatty(Deno.stdin.rid));
assert(Deno.stdout.isTerminal() === isatty(Deno.stdout.rid));
assert(Deno.stderr.isTerminal() === isatty(Deno.stderr.rid));
assert(Deno.stdin.isTerminal() === isatty((Deno as any).stdin.rid));
assert(Deno.stdout.isTerminal() === isatty((Deno as any).stdout.rid));
assert(Deno.stderr.isTerminal() === isatty((Deno as any).stderr.rid));
using file = Deno.openSync("README.md");
assert(!isatty(file.rid));