Windows: rg.exe processes never terminated, blocking app updates (file locked)

Resolved 💬 2 comments Opened Mar 6, 2026 by MinhHoangDono Closed Apr 3, 2026

Summary

The Claude Code extension spawns persistent rg.exe (ripgrep) processes on Windows for codebase indexing/search and never terminates them. These processes hold file locks on rg.exe inside the app's install directory, preventing the app's updater (Squirrel.Windows) from replacing the binary during an update. The update fails and leaves the app in a broken state requiring full reinstall.

Root Cause

Claude Code uses ripgrep (@vscode/ripgrep) for codebase search. On Windows, a running process holds an exclusive kernel-level file lock on its own executable — unlike Linux where deletion of a running binary is allowed.

Claude Code does not terminate spawned rg.exe child processes:

  • When the search/indexing task completes
  • When the editor window loses focus
  • On the extension deactivate() lifecycle hook
  • Before the Electron app emits before-quit

Steps to Reproduce

  1. Install Claude Code extension in any VSCode-based Electron editor on Windows (Cursor, VS Code, etc.)
  2. Open a project and let Claude Code index/search the codebase
  3. Observe multiple rg.exe processes in Task Manager — they remain after search completes
  4. Trigger an app update while the editor is open
  5. Expected: Update succeeds
  6. Actual: Update fails — "this action can't be completed because the file is open in rg"

Evidence

  • Observed 3+ simultaneous rg.exe processes per editor instance, unkillable via Stop-Process while the parent app is running
  • Community confirmation via VSCode Extension Bisect (devcontainer/Ubuntu, same symptom — dozens of rg processes, resolved by disabling Claude Code extension)
  • Affects all VSCode-based Electron apps on Windows that bundle ripgrep

Environment

  • OS: Windows 11 (10.0.26200.7840)
  • Affected apps: Cursor, any VSCode-based Electron app with Claude Code extension
  • Claude Code version: latest

Workaround (for users)

# Fully quit the editor first, then update
# Or kill rg before updating:
Stop-Process -Name "rg" -Force

Fix Recommendation

Claude Code extension should terminate all spawned rg.exe child processes:

  1. When the search/indexing task completes (primary fix)
  2. In the deactivate() extension lifecycle hook
  3. On Electron before-quit event
// Example in extension deactivate()
export function deactivate() {
  rgProcesses.forEach(proc => proc.kill());
  rgProcesses.clear();
}

This fix would also resolve the related issue of rg process proliferation in devcontainers on Linux (same root cause: processes not cleaned up after use).

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗