diff --git a/src/shared/command-executor/execute-hook-command.ts b/src/shared/command-executor/execute-hook-command.ts index d4ded4a55f..c33a4561cc 100644 --- a/src/shared/command-executor/execute-hook-command.ts +++ b/src/shared/command-executor/execute-hook-command.ts @@ -71,7 +71,9 @@ export async function executeHookCommand( stderr += data.toString(); }); - proc.stdin?.on("error", () => {}); + proc.stdin?.on("error", (stdinErr) => { + // Ignore stdin errors - process may have already exited + }); proc.stdin?.write(stdin); proc.stdin?.end(); @@ -100,13 +102,16 @@ export async function executeHookCommand( if (!isWin32 && proc.pid) { try { process.kill(-proc.pid, signal); - } catch { + } catch (pgErr) { + // Process group kill failed, try direct kill proc.kill(signal); } } else { proc.kill(signal); } - } catch {} + } catch (killErr) { + // Process may already be dead + } }; const timeoutTimer = setTimeout(() => { diff --git a/src/shared/spawn-with-windows-hide.ts b/src/shared/spawn-with-windows-hide.ts index 7da9ed0865..7835e885dd 100644 --- a/src/shared/spawn-with-windows-hide.ts +++ b/src/shared/spawn-with-windows-hide.ts @@ -61,7 +61,9 @@ function wrapNodeProcess(proc: ChildProcess): SpawnedProcess { } proc.kill(signal) - } catch {} + } catch (killErr) { + // Process may already be dead + } }, } } diff --git a/src/tools/lsp/lsp-client-transport.ts b/src/tools/lsp/lsp-client-transport.ts index d4590262bd..875379a1f1 100644 --- a/src/tools/lsp/lsp-client-transport.ts +++ b/src/tools/lsp/lsp-client-transport.ts @@ -109,7 +109,9 @@ export class LSPClientTransport { this.stderrBuffer.shift() } } - } catch {} + } catch (err) { + // Silently ignore stderr read errors - stream may close during process shutdown + } } read() } @@ -157,7 +159,9 @@ export class LSPClientTransport { try { this.sendNotification("shutdown", {}) this.sendNotification("exit") - } catch {} + } catch (err) { + // Ignore shutdown errors - connection may already be closed + } this.connection.dispose() this.connection = null } @@ -184,9 +188,13 @@ export class LSPClientTransport { proc.kill("SIGKILL") // Wait briefly for SIGKILL to take effect await Promise.race([proc.exited, new Promise((resolve) => setTimeout(resolve, 1000))]) - } catch {} + } catch (sigkillErr) { + // SIGKILL may fail if process already terminated + } } - } catch {} + } catch (stopErr) { + // Process cleanup errors are logged but don't prevent cleanup + } } this.processExited = true this.diagnosticsStore.clear() diff --git a/src/tools/lsp/lsp-client.ts b/src/tools/lsp/lsp-client.ts index 4785909cc4..5a2d3cfe24 100644 --- a/src/tools/lsp/lsp-client.ts +++ b/src/tools/lsp/lsp-client.ts @@ -103,7 +103,9 @@ export class LSPClient extends LSPClientConnection { if (result && typeof result === "object" && "items" in result) { return result as { items: Diagnostic[] } } - } catch {} + } catch (diagErr) { + // Diagnostic request failed, fall back to cached diagnostics + } return { items: this.diagnosticsStore.get(uri) ?? [] } } diff --git a/src/tools/lsp/lsp-process.ts b/src/tools/lsp/lsp-process.ts index 358c5c7e5b..23c0939c9a 100644 --- a/src/tools/lsp/lsp-process.ts +++ b/src/tools/lsp/lsp-process.ts @@ -126,7 +126,9 @@ function wrapNodeProcess(proc: ChildProcess): UnifiedProcess { } else { proc.kill() } - } catch {} + } catch (killErr) { + // Process may already be dead + } }, } } diff --git a/src/tools/lsp/lsp-server.ts b/src/tools/lsp/lsp-server.ts index 69a004edc6..1a1824daad 100644 --- a/src/tools/lsp/lsp-server.ts +++ b/src/tools/lsp/lsp-server.ts @@ -77,7 +77,9 @@ class LSPServerManager { // Stale init can permanently block subsequent calls (e.g., LSP process hang) try { await managed.client.stop(); - } catch {} + } catch (stopErr) { + // Ignore stop errors during stale init cleanup + } this.clients.delete(key); managed = undefined; } @@ -86,11 +88,13 @@ class LSPServerManager { if (managed.initPromise) { try { await managed.initPromise; - } catch { + } catch (initErr) { // Failed init should not keep the key blocked forever. try { await managed.client.stop(); - } catch {} + } catch (stopErr) { + // Ignore stop errors after failed init + } this.clients.delete(key); managed = undefined; } @@ -104,7 +108,9 @@ class LSPServerManager { } try { await managed.client.stop(); - } catch {} + } catch (stopErr) { + // Ignore stop errors when cleaning up dead client + } this.clients.delete(key); } } @@ -130,7 +136,9 @@ class LSPServerManager { this.clients.delete(key); try { await client.stop(); - } catch {} + } catch (stopErr) { + // Ignore stop errors after init failure + } throw error; } const m = this.clients.get(key);