fix: kill orphaned node.exe before NSIS install to prevent file lock error#948
Merged
Conversation
…error Add NSIS preinstall hook that terminates running Agent Workspace and node.exe processes before the installer extracts files. This prevents the 'Error opening file for writing' error on reinstall/update when the bundled node.exe is still running and holding a file lock on itself.
Use PowerShell path filter to kill only node.exe running from the agent-workspace install directory. Other Node.js processes are untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
node.exe(spawned as the backend server) remains running as an orphaned process after app close or uninstall, holding a file lock on itself — the NSIS installer cannot overwrite itsrc-tauri/windows/hooks.nsh) thattaskkill /FbothAgent Workspace.exeandnode.exebefore file extraction beginsFiles changed
src-tauri/windows/hooks.nsh— new NSIS hook file withNSIS_HOOK_PREINSTALLandNSIS_HOOK_PREUNINSTALLmacrossrc-tauri/tauri.conf.json— addedbundle.windows.nsis.installerHookspointing to the hook fileTest plan
npm run tauri:buildornpm run tauri:build:fast)Note
The
taskkill /IM node.exe /Fis broad and will kill all node.exe processes on the machine. This is acceptable because:🤖 Generated with Claude Code