@tritard/waterbrother 0.14.3 → 0.14.5
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/package.json +1 -1
- package/src/cli.js +14 -3
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -4774,9 +4774,20 @@ async function readInteractiveLine(options = {}) {
|
|
|
4774
4774
|
});
|
|
4775
4775
|
}
|
|
4776
4776
|
|
|
4777
|
-
//
|
|
4778
|
-
// The
|
|
4779
|
-
//
|
|
4777
|
+
// Nuclear stdin reset — force a completely clean state every time.
|
|
4778
|
+
// The readline keypress emitter guards with a Symbol and only attaches once.
|
|
4779
|
+
// After interrupt listeners, promptLine, and approval prompts mess with stdin,
|
|
4780
|
+
// the internal handler gets stale. Force it to re-attach by clearing the guard.
|
|
4781
|
+
const kEmit = Symbol.for("readline.emitKeypressEvents");
|
|
4782
|
+
if (input[kEmit]) {
|
|
4783
|
+
// Remove the old internal data listener that readline attached
|
|
4784
|
+
const oldListeners = input.rawListeners("data").slice();
|
|
4785
|
+
for (const fn of oldListeners) {
|
|
4786
|
+
// readline's internal listener is not our onData — remove all, re-add ours after
|
|
4787
|
+
input.removeListener("data", fn);
|
|
4788
|
+
}
|
|
4789
|
+
delete input[kEmit];
|
|
4790
|
+
}
|
|
4780
4791
|
if (input.isTTY) {
|
|
4781
4792
|
try { input.setRawMode(false); } catch {}
|
|
4782
4793
|
}
|