restart_claude_desktop hardening: Linux pkill can kill Claude Code sessions; macOS kill/relaunch race; Windows MSIX shortcut missing #33
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found in audit of
main@06326e5. Three platform problems inbcc_core.pyrestart_claude_desktop()(~L1826–1905).1. Linux — harmful and wrong target (worst of the three).
_restart_claude_desktop_linux()runspkill claude— no-x, so it substring-matches and can kill the user's running Claude Code CLI processes (active sessions, agents) and anything else with "claude" in the name. It then launchesclaudedetached — which on Linux is the Claude Code CLI, not Claude Desktop; spawning it headless/detached does nothing useful. There is no official Claude Desktop for Linux.Fix: at minimum use
pkill -xagainst an actual desktop binary name and launch the real desktop entry point if one is configured; realistically, hide/disable the Restart button on Linux (gate_offer_restart_button()on platform) until there is a real target.2. macOS — kill/relaunch race.
pkill -x Claudeis fire-and-forget andopen -a Clauderuns immediately after. If the old instance hasn't exited yet,opencan re-activate the dying instance (config never reloaded) or the relaunch lands mid-teardown. Fix: after pkill, poll for process exit (e.g.pgrep -x Claudeup to ~5 s) beforeopen -a Claude. Run off the UI thread if the wait is added (button handler currently calls it synchronously —MainWindow._restart_claude_desktop).3. Windows — relaunch fails for MSIX/Store installs.
Relaunch uses the Start-menu shortcut
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Claude.lnk. For an MSIX/Store install (which BCC now explicitly detects — seedetect_msix_claude) that shortcut doesn't exist, sotaskkillsucceeds and the relaunch fails: BCC kills Claude and can't bring it back. Fix: check the shortcut exists before killing; if absent, tryexplorer.exe shell:AppsFolder\<PackageFamilyName>!Appfor the detected MSIX package, or refuse with a clear message instead of killing first.Acceptance
pkillpattern that can matchclaudeCLI processes remains.