project-compass 3.3.3 → 3.3.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 +24 -6
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -261,7 +261,13 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
261
261
|
|
|
262
262
|
const killAllTasks = useCallback(() => {
|
|
263
263
|
runningProcessMap.current.forEach((proc) => {
|
|
264
|
-
try {
|
|
264
|
+
try {
|
|
265
|
+
if (proc.pid) {
|
|
266
|
+
process.kill(-proc.pid, 'SIGKILL');
|
|
267
|
+
} else {
|
|
268
|
+
proc.kill('SIGKILL');
|
|
269
|
+
}
|
|
270
|
+
} catch { /* ignore */ }
|
|
265
271
|
});
|
|
266
272
|
runningProcessMap.current.clear();
|
|
267
273
|
}, []);
|
|
@@ -290,6 +296,7 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
290
296
|
cwd: project.path,
|
|
291
297
|
env: process.env,
|
|
292
298
|
stdin: 'pipe',
|
|
299
|
+
detached: true,
|
|
293
300
|
cleanup: true
|
|
294
301
|
});
|
|
295
302
|
runningProcessMap.current.set(taskId, subprocess);
|
|
@@ -316,12 +323,21 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
316
323
|
const handleKillTask = useCallback((taskId) => {
|
|
317
324
|
const proc = runningProcessMap.current.get(taskId);
|
|
318
325
|
if (proc) {
|
|
319
|
-
|
|
326
|
+
addLogToTask(taskId, kleur.yellow('! Force killing process group...'));
|
|
327
|
+
try {
|
|
328
|
+
if (proc.pid) {
|
|
329
|
+
process.kill(-proc.pid, 'SIGKILL');
|
|
330
|
+
} else {
|
|
331
|
+
proc.kill('SIGKILL');
|
|
332
|
+
}
|
|
333
|
+
} catch (e) {
|
|
334
|
+
addLogToTask(taskId, kleur.red(`✗ Kill failed: ${e.message}`));
|
|
335
|
+
}
|
|
320
336
|
} else {
|
|
321
337
|
setTasks(prev => prev.filter(t => t.id !== taskId));
|
|
322
338
|
if (activeTaskId === taskId) setActiveTaskId(null);
|
|
323
339
|
}
|
|
324
|
-
}, [activeTaskId]);
|
|
340
|
+
}, [activeTaskId, addLogToTask]);
|
|
325
341
|
|
|
326
342
|
const exportLogs = useCallback(() => {
|
|
327
343
|
const taskToExport = tasks.find(t => t.id === activeTaskId);
|
|
@@ -465,9 +481,11 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
465
481
|
}
|
|
466
482
|
|
|
467
483
|
if (running && activeTaskId && runningProcessMap.current.has(activeTaskId)) {
|
|
468
|
-
|
|
469
|
-
if (key.
|
|
470
|
-
|
|
484
|
+
if (key.ctrl && input === 'c') { handleKillTask(activeTaskId); setStdinBuffer(''); setStdinCursor(0); return; }
|
|
485
|
+
if (key.return) {
|
|
486
|
+
const proc = runningProcessMap.current.get(activeTaskId);
|
|
487
|
+
proc?.stdin?.write(stdinBuffer + '\n'); setStdinBuffer(''); setStdinCursor(0); return;
|
|
488
|
+
}
|
|
471
489
|
if (key.backspace || key.delete) {
|
|
472
490
|
if (stdinCursor > 0) {
|
|
473
491
|
setStdinBuffer(prev => prev.slice(0, stdinCursor - 1) + prev.slice(stdinCursor));
|