Archive: ExecTimeout Plugin


ExecTimeout Plugin
I just created an "ExecTimeout" plugin. It will execute and application and wait for the process to exit, just like ExecWait. But in contrast to ExecWait you can specify a timeout. If the application does not exit before the timeout exceeds, it will be terminated. This can be used to make sure your installer won't stall, even if the application doesn't exit for some reason. Plugin, sources and example attached.


Here is a small update. You can now decide whether you want to terminate the process on timeout or leave it alone. Anyway, if the timeout is exceeded, the control will return to the installer immediately.


Another update:
Better method to pass the parameters and simplification of the return value :)


You should use the Wiki to upload your file.
http://nsis.sf.net/File:ExecTimeout.zip

Stu


You think it's worth a wiki page? ^^


Sure why not. Otherwise as you add new versions people will never get them. People tend to get the first download in the first post and neglect to find the latest.

Stu


Besides that Stu said, after 2-3 days of inactivity this thread will get lost between 1000s threads of the forum.
A wiki page is always easy accessible, thus useful to everybody anytime.


Okay, I have created a wiki page :)
http://nsis.sourceforge.net/ExecTimeout_plug-in


You should re-upload as ExecTimeout.zip. Notice that re-uploading the file under the same name builds a revision history:
http://nsis.sourceforge.net/File:LockedList.zip

Stu


Hi,

hmm... i don't quiet get it...

Where's the difference to nsExec with the /TIMEOUT=x flag?

Anyways, thanks for your support on it LoRd_MuldeR.

Edit:

Here a line of code from my installer:

nsExec::ExecToStack /TIMEOUT=$0 'mycmd'

Originally posted by elllit
Hi,

hmm... i don't quiet get it...

Where's the difference to nsExec with the /TIMEOUT=x flag?
If I understand nsExec correctly, then it the /TIMEOUT param will return control to the installer if there was no output by the application for x milliseconds. Also the timeout will be reset when there is new output. So this is only useful for console applications, that write stuff to stdout. It's not useful for GUI applications! Also I'm not sure whether nsExec will terminate the process on timeout or simply leave it alone. My plugin can do both! And it doesn't care about console output, it simply returns control to the installer after a maximum of x milliseconds. So you can be sure that your installer won't stall! Using nsExec an application could constantly write random stuff to stdout and do so until forever. So that application would never timeout and your installer will stall...

Of course my ExecTimeout plugin is useless if you need to capture the console output. It was never intended to do that. I said it's a very simple plugin...


The timeout value is optional.  The timeout is the time in
milliseconds nsExec will wait for output. If output from the
process is received, the timeout value is reset and it will
again wait for more output using the timeout value.

I have moved the plug-in download to http://nsis.sourceforge.net/File:ExecTimeout.zip.
If you need to upload revisions upload to that page and put the date as the summary.

Stu


LoRd_MuldeR,

thanks for the clarification.


I have uploaded an example that illustrates the difference:


Thanks a bunch!

I will move over to your plug-in as it seems less error prone from useage side. At least on my concern.


Trying to get this plugin to work with the Internet plugin. Here is my code:

${ExecTimeout} 'Internet::GetUrlCode "$2" "logo.jpg" ${VAR_3}' 5000 1 $0

It is not working, any ideas?


Originally posted by erik@winepos.com
Trying to get this plugin to work with the Internet plugin. Here is my code:

${ExecTimeout} 'Internet::GetUrlCode "$2" "logo.jpg" ${VAR_3}' 5000 1 $0

It is not working, any ideas?
This plug-in is used to execute a child process. The first parameter has to be a command-line! You can not use the plug-in to run a function from another unrelated plug-in. Support for "timeout" functionality has to be implemented in each individual plug-in...