Archive: uninstall.exe not always created succesfully


uninstall.exe not always created succesfully
Hello,

I have inherited the task of helping maintain an NSIS script. This is my first experience with this scripting language.

Sometimes the script will properly create an uninstaller, sometimes it will not. I do not know if it has ever worked reliably.

I have googled, searched through forum postings, the official NSIS documentation and still am unable to come up with a solution.

The script was written in NSIS 2.32 and I am using version 2.32. Basically the install script creates an un-installer in the following fashion:

SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe

Under one circumstance (we will call this circumstance A) the uninstall.exe is created and works properly. Under another set of circumstance (we will call this circumstance B) I receive the error message "Unable to create uninstall.exe".

The only difference between the two circumstances is that under circumstance B a component section is run that pipes out and runs a self extracting WinRAR file. The file is broken into parts across 4 DVDs. Under circumstance A (when the installer installs correctly) this component is not chosen and therefore the section is not run.

So my question is why would I be receiving an error when trying to write the uninstall.exe file? Is WinRAR running and taking so much time to extract files accounting for this?

I was not quite sure if including the entire code was appropriate here. If so please let me know and I will attach it.

Regards,
Andrew


I have discovered a work around for this problem but I am not sure why it works. Perhaps someone can enlighten me.

Currently WriteUninstaller is called in a section named Section -post SECMyUninstaller

I simply moved WriteUninstaller into its own section which runs last (however before the -post section). Can anyone shed some light?


I'd guess WinRAR runs asynchronously instead of asynchronously and in some point purges the directory where you install your files and the uninstaller. If moving it somewhere else affects things, you probably have a race condition with something that deletes the directory. Run FileMon.exe and see what happens.