summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2020-10-20 19:20:17 +0800
committerGitHub <noreply@github.com>2020-10-20 13:20:17 +0200
commitd9ae74019ef6982acb45d2688d71b99f2191b38d (patch)
tree1760341349e9e15fd1ab1ba71925f3d18ddaecae
parent9141c76b25e0daf427617903a9a988980075430a (diff)
fix(cli): use rid getter for stdio (#8014)
This changes the rid of Deno.stdin, Deno.stdout, Deno.stderr from a mutable property into a getter to match the rid semantics of Deno.File.
-rw-r--r--cli/dts/lib.deno.ns.d.ts6
-rw-r--r--cli/rt/30_files.js15
2 files changed, 15 insertions, 6 deletions
diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts
index d33eb8a0b..276f13e37 100644
--- a/cli/dts/lib.deno.ns.d.ts
+++ b/cli/dts/lib.deno.ns.d.ts
@@ -710,11 +710,11 @@ declare namespace Deno {
}
/** A handle for `stdin`. */
- export const stdin: Reader & ReaderSync & Closer & { rid: number };
+ export const stdin: Reader & ReaderSync & Closer & { readonly rid: number };
/** A handle for `stdout`. */
- export const stdout: Writer & WriterSync & Closer & { rid: number };
+ export const stdout: Writer & WriterSync & Closer & { readonly rid: number };
/** A handle for `stderr`. */
- export const stderr: Writer & WriterSync & Closer & { rid: number };
+ export const stderr: Writer & WriterSync & Closer & { readonly rid: number };
export interface OpenOptions {
/** Sets the option for read access. This option, when `true`, means that the
diff --git a/cli/rt/30_files.js b/cli/rt/30_files.js
index e492da218..679b184fd 100644
--- a/cli/rt/30_files.js
+++ b/cli/rt/30_files.js
@@ -109,7 +109,10 @@
class Stdin {
constructor() {
- this.rid = 0;
+ }
+
+ get rid() {
+ return 0;
}
read(p) {
@@ -127,7 +130,10 @@
class Stdout {
constructor() {
- this.rid = 1;
+ }
+
+ get rid() {
+ return 1;
}
write(p) {
@@ -145,7 +151,10 @@
class Stderr {
constructor() {
- this.rid = 2;
+ }
+
+ get rid() {
+ return 2;
}
write(p) {