@tuanhv/op-cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/io/node-io.js +6 -0
- package/package.json +1 -1
package/dist/io/node-io.js
CHANGED
|
@@ -44,6 +44,12 @@ export function createNodeIo(input = process.stdin, output = process.stdout, err
|
|
|
44
44
|
const decoder = new StringDecoder("utf8");
|
|
45
45
|
let answer = "";
|
|
46
46
|
let terminated = false;
|
|
47
|
+
// A preceding askLine closed its readline interface, which pauses the
|
|
48
|
+
// input; on a socket-backed stdin that stops the read handle, and the
|
|
49
|
+
// async iterator below never restarts it, so the event loop would drain
|
|
50
|
+
// and abort the awaited run(). resume() restarts the handle; the
|
|
51
|
+
// iterator's readable listener takes over before any chunk can flow.
|
|
52
|
+
input.resume();
|
|
47
53
|
try {
|
|
48
54
|
for await (const chunk of input) {
|
|
49
55
|
const text = typeof chunk === "string" ? chunk : decoder.write(chunk);
|