electron-builder: NSIS uninstaller doesn't kill child processes
- Version: 19.54.0
- Target: Windows x64
NSIS uninstaller checks the app is still running and kills it by nsProcess::KillProcess before deleting the installed files. However, nsProcess::KillProcess seems neither emitting any window-alll-closed and quit events, nor kills child (and grand child) processes. Hence, child processes spawned by the app keep running and block files are deleted.
Using taskkill instead of nsProcess::KillProcess might solve this problem.
I found some related discussions:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (5 by maintainers)
Commits related to this issue
- fix: NSIS uninstaller doesn't kill child processes Close #2516 — committed to develar/electron-builder by develar 6 years ago
- fix(nsis): ensure that installer process is not killed as child process Close #2516 — committed to develar/electron-builder by develar 6 years ago
- fix(nsis): ensure that installer process is not killed as child process Close #2516 — committed to develar/electron-builder by develar 6 years ago
- fix(nsis): NSIS uninstaller doesn't kill child processes Close #2516 — committed to develar/electron-builder by develar 6 years ago
tree kill is not used now — now app is killed softly at first and it should be enough to terminate child process.
Hi @develar , I am still seeing the problem of installer apparently being killed during autoupdate with 20.4.1.
Caveat: 2 years or so ago the installer didnt finish a running application on its own yet so I had added the following as custom NSIS include do do this from my end:
this led to the error message
a few days ago (while having worked fine for close to 2 years). So I took it out and now see the installer closing the original running install and not installing the new version (no logs being produced). I.e.: not sure if it is a coincidence (me removing the custom nsis exit-running-app code while this ticket was coming up) or whether the fix 12 hours ago is maybe not complete yet.
Gladly let me know if there is any other info I could provide to shed some light on this.
@jkawamoto @develar set {detached: true, stdio: ’ignore’},This just means “On Windows, setting options.detached to true makes it possible for the child process to continue running after the parent exits. The child will have its own console window.”,But if you kill the process tree(with ‘’taskkill /t‘’),all the processes will be killed ,because the parent-child relationship between processes will not change; moreover,‘’taskkill /t‘’ a is higher than “PID ne $pid” of priority,so it will still kill installation process.
As shown: pid-4816 is a child processes of pid-4046,pid-4816 is installation process,pid-4046 is main application,and “好药店.exe” is APP_EXECUTABLE_FILENAME. pid-4816, pid-4046, pid-7512(another child process) ,They are all killed