mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
8178f758bc
This PR adds private `[REF]()` and `[UNREF]()` methods to Stdin class, and call them from Node.js polyfill layer (`TTY` class). This enables `process.stdin.unref()` and `process.stdin.ref()` for the case when stdin is terminal. closes #21796
14 lines
360 B
JavaScript
14 lines
360 B
JavaScript
import process from "node:process";
|
|
import util from "node:util";
|
|
|
|
console.log("START");
|
|
globalThis.addEventListener("unload", () => console.log("END"));
|
|
|
|
const args = util.parseArgs({ options: { unref: { type: "boolean" } } });
|
|
|
|
// call stdin.unref if --unref is passed
|
|
if (args.values.unref) {
|
|
process.stdin.unref();
|
|
}
|
|
|
|
process.stdin.pipe(process.stdout);
|