question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NSIS uninstaller doesn't kill child processes

See original GitHub issue
  • 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:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
develarcommented, Mar 10, 2018

tree kill is not used now — now app is killed softly at first and it should be enough to terminate child process.

1reaction
consensecommented, Mar 9, 2018

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:

!macro customInit
    ; SHUT DOWN APP IF CURRENTLY RUNNING
    ${GetProcessInfo} 0 $0 $1 $2 $3 $4
    ${if} $3 != "${APP_EXECUTABLE_FILENAME}"
        ${nsProcess::FindProcess} "${APP_EXECUTABLE_FILENAME}" $R0
        ${If} $R0 == 0
            ;MessageBox MB_OK "App currently running - going to shutdown to install new version"
            ${nsProcess::CloseProcess} "${APP_EXECUTABLE_FILENAME}" $R0
            Sleep 5000
            ${nsProcess::KillProcess} "${APP_EXECUTABLE_FILENAME}" $R0
            Sleep 3000
        ${EndIf}
        ${nsProcess::Unload}
    ${endIf}
!macroend

this led to the error message

Plugin not found, cannot call ${nsProcess::FindProcess}
Error in macro customInit on macroline 4
Error in script "<stdin>" on line 131 -- aborting creation process
  • exited          command=makensis.exe code=1 pid=1040
  • async task error error=
                       Error: \tmp-electron-builder\nsis\nsis-3.0.1.13\Bin\makensis.exe exited with code 1
                           at ChildProcess.childProcess.once.code (C:\cygwin64\home\sshd\builds\code\screenawar

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Waiting for NSIS uninstaller to finish in NSIS installer either ...
I read that ExecWait only waits until the uninstaller is copied to and started in the temp directory. It definitively doesn't wait for...
Read more >
Chapter 4: Scripting Reference
A NSIS Script File (.nsi) is just a text file with script code. ... For example, if you write the uninstaller to $WINDIR...
Read more >
A brand new website interface for an even better experience!
NSIS uninstaller doesn't kill child processes.
Read more >
Uninstall runs but doesn't delete open programs - NSIS Forums
Uninstall runs but doesn't delete open programs. Does anyone know of a way to help nsis deal with open programs during the uninstall...
Read more >
NSIS 2.46 Users Manual - SourceForge
NSIS supports different compression methods, as explained here. ... For example, if you write the uninstaller to $WINDIR and the user doesn't move...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found