icoa-cli 2.19.74 → 2.19.75
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/repl.js +22 -6
- package/package.json +1 -1
package/dist/repl.js
CHANGED
|
@@ -873,20 +873,36 @@ export async function startRepl(program, resumeMode) {
|
|
|
873
873
|
}
|
|
874
874
|
function runSystemCommand(input, rl, cwd) {
|
|
875
875
|
return new Promise((resolve) => {
|
|
876
|
+
// Fully release the TTY so interactive children (python3, bash, etc.)
|
|
877
|
+
// get a clean terminal with proper echo. `rl.pause()` alone doesn't
|
|
878
|
+
// reset raw mode or release stdin — readline keeps it in line-editing
|
|
879
|
+
// mode where typed characters don't display until our REPL reads a line.
|
|
880
|
+
const stdin = process.stdin;
|
|
881
|
+
const wasRaw = stdin.isTTY ? !!stdin.isRaw : false;
|
|
876
882
|
rl.pause();
|
|
883
|
+
if (stdin.isTTY && typeof stdin.setRawMode === 'function') {
|
|
884
|
+
try {
|
|
885
|
+
stdin.setRawMode(false);
|
|
886
|
+
}
|
|
887
|
+
catch { }
|
|
888
|
+
}
|
|
877
889
|
const child = spawn(input, {
|
|
878
890
|
shell: true,
|
|
879
891
|
stdio: 'inherit',
|
|
880
892
|
cwd: cwd || process.cwd(),
|
|
881
893
|
});
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
894
|
+
const restore = () => {
|
|
895
|
+
if (stdin.isTTY && typeof stdin.setRawMode === 'function' && wasRaw) {
|
|
896
|
+
try {
|
|
897
|
+
stdin.setRawMode(true);
|
|
898
|
+
}
|
|
899
|
+
catch { }
|
|
900
|
+
}
|
|
887
901
|
rl.resume();
|
|
888
902
|
resolve();
|
|
889
|
-
}
|
|
903
|
+
};
|
|
904
|
+
child.on('close', restore);
|
|
905
|
+
child.on('error', restore);
|
|
890
906
|
});
|
|
891
907
|
}
|
|
892
908
|
function mapCommand(input) {
|