[PR #5875] fix(lsp): use Shell.killTree for proper process cleanup #11624

Open
opened 2026-02-16 18:16:30 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5875

State: open
Merged: No


Summary

  • Use Shell.killTree() in LSP client shutdown for proper process tree cleanup
  • Add spawnLSP() helper that sets detached: true (required for process group kill)

Problem

LSP shutdown was using process.kill() directly which:

  • Only sends SIGTERM without SIGKILL escalation
  • Doesn't kill child processes (e.g., tsserver spawned by typescript-language-server)
  • Doesn't handle Windows process trees

Solution

  • client.ts: Use Shell.killTree() which properly kills process groups and escalates to SIGKILL
  • server.ts: Add spawnLSP() wrapper that spawns with detached: true on Unix (required for -pid group kill)

Related: #3057, #5525

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5875 **State:** open **Merged:** No --- ## Summary - Use `Shell.killTree()` in LSP client shutdown for proper process tree cleanup - Add `spawnLSP()` helper that sets `detached: true` (required for process group kill) ## Problem LSP shutdown was using `process.kill()` directly which: - Only sends SIGTERM without SIGKILL escalation - Doesn't kill child processes (e.g., `tsserver` spawned by `typescript-language-server`) - Doesn't handle Windows process trees ## Solution - `client.ts`: Use `Shell.killTree()` which properly kills process groups and escalates to SIGKILL - `server.ts`: Add `spawnLSP()` wrapper that spawns with `detached: true` on Unix (required for `-pid` group kill) Related: #3057, #5525
yindo added the pull-request label 2026-02-16 18:16:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11624