mirror of
https://github.com/denoland/deno.git
synced 2024-12-01 16:51:13 -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);
|