1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 08:33:43 -05:00

fix(npm): process not defined in readline (#19184)

Issue was that we create node globals much later, so pulling `process`
via a module import is the way to go.

Fixes #19183
This commit is contained in:
Marvin Hagemeister 2023-05-18 21:42:27 +02:00 committed by GitHub
parent 877b38b370
commit ff0daa2b9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View file

@ -12,3 +12,16 @@ Deno.test("[node/readline] createInstance", () => {
// deno-lint-ignore no-explicit-any
assertInstanceOf(rl, Interface as any);
});
// Test for https://github.com/denoland/deno/issues/19183
Deno.test("[node/readline] don't throw on rl.question()", () => {
const rli = createInterface({
input: new Readable({ read() {} }),
output: new Writable({ write() {} }),
terminal: true,
});
// Calling this would throw
rli.question("foo", () => rli.close());
rli.close();
});

View file

@ -44,6 +44,7 @@ import {
} from "ext:deno_node/internal/readline/utils.mjs";
import { clearScreenDown, cursorTo, moveCursor } from "ext:deno_node/internal/readline/callbacks.mjs";
import { Readable } from "ext:deno_node/_stream.mjs";
import process from "ext:deno_node/process.ts";
import { StringDecoder } from "ext:deno_node/string_decoder.ts";
import {