Archive: Help... cant get release


Help... cant get release
I have been using NSIS for several months now to help automate the distribution of my software... but I have had one recurring problem.

The application that I written follows this process:

1) it recognizes that it needs to update itself
2) it streams the update file from the server
3) it then launches the null soft wrapped update exe and closes itself
4) the null soft package launches fine
5) when it runs it attempts to unbundle the new version of my software
6) windows has not always finished releasing the instance of my application
7) 1 out of every 2 times it fails and asks the user if they wish to "Retry", which I have had to train my users to always "retry"
8) after several clicks it will recognize that windows has released the application instance... and then it succedes..

I have put sleep commands in, and findwindow + sleep command which helped a little.... but unfortuantely it seems that Null Soft runs synchronously and does not let the operating system complete its work.

What I need is a "process messages" call.... a way to tell the null soft process to chill, and let windows do its homework before proceeding. (demote my thread temporarily)

Any thoughts?

matthew@smartrestaurant.com


Make your application add a global mutex, and release that mutex when you exit the application. Then write a plug-in for NSIS (using Contrib\ExDLL structure) that will wait for this mutex to vanish. A better way would be writing to plug-in to keep trying to open the EXE until it succeeds and then let the installer continue.


Still wondering
Thanks... I can try this... but I am still wondering if it is difficult to invoke an API call (or similar) that tells the cpu to demote the nsis thread in favor of other system processes.. thus allowing it to finish, and then allowing the nsis to complete satisfactorily 100% of the time.


Relaying on something to wait a certain number of seconds for it to finish before another thing is never a good idea. There is no way you can be absolutely sure that NSIS will wait enough time. You shold "ask" your program when it finishes.


this is what i was hoping would work...
sit and spin until the window class goes away...


window_go_away:
Sleep 500
FindWindow $0 "tViewSplash" ""
IsWindow $0 window_go_away

Sleep 200

File "C:\SmartTouch\SmartTouch.exe"
SectionEnd


The window class is destroyed before the process exits.


I have tried this morning... unsuccessfully.

I created a function in the dll to recurrently try to create the applications mutex and contiue until success. The function is exported. The dll was built and placed in the same directory as makensis and my .nsi file.

The script fails to recognize my function.

Any ideas??

Thanks very much.


Put it in the plugins directory or use PluginsDir.