Skip to content

Commit 9edd662

Browse files
authored
fix(doctor): force-stop stalled TUI process probes (#109243)
1 parent 5680791 commit 9edd662

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎src/commands/doctor-whatsapp-responsiveness.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ describe("doctor WhatsApp responsiveness", () => {
5050
{ pid: 104, command: "openclaw tui --local" },
5151
{ pid: 105, command: "/usr/bin/openclaw chat" },
5252
]);
53+
expect(spawnSyncMock).toHaveBeenCalledWith("ps", ["-axo", "pid=,command="], {
54+
encoding: "utf8",
55+
killSignal: "SIGKILL",
56+
timeout: 1_000,
57+
});
5358
}
5459
});
5560

‎src/commands/doctor-whatsapp-responsiveness.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type ProcessController = {
2121

2222
const LOCAL_TUI_SUBCOMMANDS = new Set(["chat", "terminal", "tui"]);
2323
const WHATSAPP_RESPONSIVENESS_CHECK_ID = "core/doctor/whatsapp-responsiveness";
24+
const LOCAL_TUI_PROCESS_PROBE_TIMEOUT_MS = 1_000;
2425

2526
function tokenizeCommandLine(command: string): string[] {
2627
return command.trim().split(/\s+/u).filter(Boolean);
@@ -62,7 +63,8 @@ function listLocalTuiProcesses(): LocalTuiProcess[] {
6263
}
6364
const ps = spawnSync("ps", ["-axo", "pid=,command="], {
6465
encoding: "utf8",
65-
timeout: 1000,
66+
killSignal: "SIGKILL",
67+
timeout: LOCAL_TUI_PROCESS_PROBE_TIMEOUT_MS,
6668
});
6769
if (ps.error || ps.status !== 0 || typeof ps.stdout !== "string") {
6870
return [];

0 commit comments

Comments
 (0)