mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
22 lines
417 B
JavaScript
22 lines
417 B
JavaScript
|
import process from "node:process";
|
||
|
|
||
|
function prompt() {
|
||
|
process.stdin.setRawMode(true);
|
||
|
|
||
|
const { promise, resolve } = Promise.withResolvers();
|
||
|
|
||
|
const onData = (buf) => {
|
||
|
process.stdin.setRawMode(false);
|
||
|
process.stdin.removeListener("data", onData);
|
||
|
console.log(buf.length);
|
||
|
resolve();
|
||
|
};
|
||
|
|
||
|
process.stdin.on("data", onData);
|
||
|
return promise;
|
||
|
}
|
||
|
|
||
|
await prompt();
|
||
|
await prompt();
|
||
|
Deno.exit(0);
|