Search code examples
nsis

Uninstall is still running after installer exits


I am not sure how to put this here, I will do my best. Please help me out

I have a patch installer, which installs and uninstalls as expected. But after uninstalling the patch from program files, I have tried uninstall other software. All I got a pop message saying that let the uninstall finish uninstalling.

All I figured out is at the end of uninstalling my patch, I am starting a process by executing .exe file. My uninstaller waits for that process to quit, which I do not want to quit.

Other option I have is to force the user to reboot after uninstalling the patch, which I do not wish to do.

I tried Exec, ExecDos, and ExecCmd with /ASYNC, but I still see the same problem.

Try 1

ExecShell open "$INSTDIR\system\teven.exe" 

Try 2

ExecDos::exec /NOUNLOAD /ASYNC "$INSTDIR\system\teven.exe" ""
Pop $0
ExecDos::isdone /NOUNLOAD $0

Can anyone help me to solve this. How can I start teven.exe and left it running and make my uninstaller not waiting teven.exe to quit.


Solution

  • You pretty much have to force the uninstaller to wait if you are going to do other things after the uninstaller completes. When you uninstall from Add/Remove programs Windows even forces a wait for all your child processes started by the uninstaller...

    Why are you using /ASYNC if you want to wait? (Edit: I guess you don't want to wait?) ExecDos::isdone does not wait, it just checks, use ExecDos::wait if you want to wait.

    If you are not using advanced options and don't need stdin input then you don't really need to use 3rd-party plugins:

    If teven is a console application and you want to hide the console window (and wait):

    nsExec::Exec '"$INSTDIR\system\teven.exe"'
    

    otherwise:

    ExecWait '"$INSTDIR\system\teven.exe"'
    

    If you actually don't want to wait you can just use Exec but Windows might force a wait anyway when uninstalling...