lunel-cli 0.1.109 → 0.1.110
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/index.js +12 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -70,6 +70,12 @@ const terminals = new Set();
|
|
|
70
70
|
// PTY binary process
|
|
71
71
|
let ptyProcess = null;
|
|
72
72
|
const ptyPendingSpawns = new Map();
|
|
73
|
+
function getDefaultTerminalShell() {
|
|
74
|
+
if (process.platform === "win32") {
|
|
75
|
+
return process.env.COMSPEC || "C:\\Windows\\System32\\cmd.exe";
|
|
76
|
+
}
|
|
77
|
+
return process.env.SHELL || "/bin/sh";
|
|
78
|
+
}
|
|
73
79
|
const processes = new Map();
|
|
74
80
|
const processOutputBuffers = new Map();
|
|
75
81
|
// CPU usage tracking
|
|
@@ -1389,6 +1395,11 @@ async function ensurePtyProcess() {
|
|
|
1389
1395
|
emitAppEvent(msg);
|
|
1390
1396
|
}
|
|
1391
1397
|
else if (event.event === "error") {
|
|
1398
|
+
const pending = ptyPendingSpawns.get(event.id);
|
|
1399
|
+
if (pending) {
|
|
1400
|
+
pending.reject(new Error(String(event.message || "PTY error")));
|
|
1401
|
+
ptyPendingSpawns.delete(event.id);
|
|
1402
|
+
}
|
|
1392
1403
|
console.error(`[pty] Error for ${event.id}: ${event.message}`);
|
|
1393
1404
|
}
|
|
1394
1405
|
});
|
|
@@ -1401,7 +1412,7 @@ function sendToPty(cmd) {
|
|
|
1401
1412
|
}
|
|
1402
1413
|
async function handleTerminalSpawn(payload) {
|
|
1403
1414
|
await ensurePtyProcess();
|
|
1404
|
-
const shell = payload.shell ||
|
|
1415
|
+
const shell = payload.shell || getDefaultTerminalShell();
|
|
1405
1416
|
const cols = payload.cols || 80;
|
|
1406
1417
|
const rows = payload.rows || 24;
|
|
1407
1418
|
const terminalId = `term-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
|