Old 27th June 2008, 20:44   #1
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
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.
Attached Files
File Type: zip exectimeout.2008-06-27.zip (44.1 KB, 386 views)
LoRd_MuldeR is offline   Reply With Quote
Old 27th June 2008, 23:02   #2
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
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.
Attached Files
File Type: zip exectimeout.2008-06-28.zip (44.6 KB, 376 views)
LoRd_MuldeR is offline   Reply With Quote
Old 1st July 2008, 21:18   #3
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Another update:
Better method to pass the parameters and simplification of the return value
Attached Files
File Type: zip exectimeout.2008-07-01.zip (44.3 KB, 384 views)
LoRd_MuldeR is offline   Reply With Quote
Old 1st July 2008, 21:27   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You should use the Wiki to upload your file.
http://nsis.sf.net/File:ExecTimeout.zip

Stu
Afrow UK is offline   Reply With Quote
Old 1st July 2008, 21:35   #5
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
You think it's worth a wiki page? ^^

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 1st July 2008, 21:43   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 1st July 2008, 21:49   #7
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
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.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 1st July 2008, 22:08   #8
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Okay, I have created a wiki page
http://nsis.sourceforge.net/ExecTimeout_plug-in

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 2nd July 2008, 09:01   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 2nd July 2008, 09:57   #10
elllit
Junior Member
 
Join Date: Jun 2008
Location: Germany
Posts: 18
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:

code:
nsExec::ExecToStack /TIMEOUT=$0 'mycmd'
elllit is offline   Reply With Quote
Old 2nd July 2008, 12:58   #11
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
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...


code:
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.


Last edited by LoRd_MuldeR; 2nd July 2008 at 13:33.
LoRd_MuldeR is offline   Reply With Quote
Old 2nd July 2008, 13:41   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 2nd July 2008, 14:03   #13
elllit
Junior Member
 
Join Date: Jun 2008
Location: Germany
Posts: 18
LoRd_MuldeR,

thanks for the clarification.
elllit is offline   Reply With Quote
Old 2nd July 2008, 14:20   #14
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
I have uploaded an example that illustrates the difference:
Attached Files
File Type: zip timeoutdemo.zip (50.2 KB, 399 views)
LoRd_MuldeR is offline   Reply With Quote
Old 3rd July 2008, 08:36   #15
elllit
Junior Member
 
Join Date: Jun 2008
Location: Germany
Posts: 18
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.
elllit is offline   Reply With Quote
Old 30th July 2013, 20:43   #16
erik@winepos.com
Junior Member
 
Join Date: Jul 2013
Posts: 4
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?
erik@winepos.com is offline   Reply With Quote
Old 30th July 2013, 23:45   #17
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally Posted by erik@winepos.com View Post
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...

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 21st July 2016, 20:53   #18
ericpode
Junior Member
 
Join Date: Dec 2007
Posts: 7
I've been using the ExecTimeout plugin with an older version of NSIS. I updated to version 2.51 of NSIS and found that my script would not compile.

So I downloaded the ExecTimeout.zip demo and found that that generated the same compile error:

Quote:
InitPluginsDir
File: "myapp.exe"->"$PLUGINSDIR\myapp.exe" [compress] 9015/16384 bytes
MessageBox: 64: "I will start the application with ExecTimeout now. It will time out after 5 seconds!"
DetailPrint: "Executing: "$PLUGINSDIR\myapp.exe""
!insertmacro: ExecTimeout
Invalid command: Timeout::ExecTimeout
Error in macro ExecTimeout on macroline 1
Error in script "C:\Users\Eric\Downloads\ExecTimeout.Demo\TimeoutDemo.nsi" on line 46 -- aborting creation process
Is there a fix for this - or maybe a different plugin that needs to be used with v2.51 ?
ericpode is offline   Reply With Quote
Old 21st July 2016, 21:27   #19
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Looks like the plug-in function is missing, i.e. the plug-in DLL was not loaded at all.

Are you 100% sure plug-in DLL is in proper "plugins" directory?

Also note that this plug-in is ANSI only, but maybe you use Unicode version of NSIS now? (which actually is a good idea)

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 22nd July 2016, 11:47   #20
ericpode
Junior Member
 
Join Date: Dec 2007
Posts: 7
Oops - I guess the install of 1.52 must have cleared out the plugins directory. I copied the DLL in there again and it seems to work OK now. Thanks.

Quote:
this plug-in is ANSI only, but maybe you use Unicode version of NSIS now?
I have no idea. There only seems to be one download for v1.52 - I just installed that.

How would I choose between ANSI and Unicode versions? What would happen if I tried to use the plugin in the ANSI version of NSIS - an error message in compilation or when the installer was run? Is it fairly easy to make a Unicode version of the plugin perhaps if the source code was available?
ericpode is offline   Reply With Quote
Old 23rd July 2016, 00:15   #21
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,100
The compiler can't tell if you mismatch plugins. The installer might crash or the plugin call will not work correctly.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th April 2019, 15:49   #22
vbp13
Junior Member
 
Join Date: Apr 2019
Posts: 1
Plugin not found, cannot call Timeout::ExecTimeout

I tried to run the example "TestTimeout.nsi"

and got this error.

Plugin not found, cannot call Timeout::ExecTimeout
vbp13 is offline   Reply With Quote
Old 29th April 2019, 18:22   #23
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 334
Quote:
Originally Posted by vbp13 View Post
I tried to run the example "TestTimeout.nsi"

and got this error.

Plugin not found, cannot call Timeout::ExecTimeout
after download and extract the ExecTimeout.zip you must copy Timeout.dll to the nsis patch
you must copy Timeout.dll to:

Windows x32:
C:\Program Files\NSIS\Plugins\x86-ansi

Windows x64:
C:\Program Files (x86)\NSIS\Plugins\x86-ansi

after that you can compile TestTimeout.nsi without error
r2du-soft is offline   Reply With Quote
Old 29th April 2019, 18:57   #24
Nutzzz
Member
 
Join Date: May 2007
Location: Orange County, CA, U.S.A.
Posts: 58
Quote:
Originally Posted by r2du-soft View Post
after download and extract the ExecTimeout.zip you must copy Timeout.dll to the nsis [path]
I prefer not messing with the NSIS folder for third-party plugins and instead using
!AddPluginDir
Nutzzz is offline   Reply With Quote
Old 30th April 2019, 14:55   #25
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,100
Quote:
Originally Posted by Nutzzz View Post
I prefer not messing with the NSIS folder for third-party plugins and instead using
!AddPluginDir
I do this as well. You can also make it automatic so all plug-ins are available for all NSIS installs on your machine.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump