ExecTimeout plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
LoRd MuldeR (talk | contribs) |
LoRd MuldeR (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
== Usage == | == Usage == | ||
This is the syntax of ExecTimeout: | |||
<pre>Usage: | <pre>Usage: | ||
Line 15: | Line 17: | ||
Return Value: | Return Value: | ||
<ExitCode> will return the exit code of the application, "timeout" or "error"</pre> | <ExitCode> will return the exit code of the application, "timeout" or "error"</pre> | ||
== Includes == | |||
Include this in your script to use the ExecTimeout plugin. | |||
<highlight-nsis>!macro ExecTimeout commandline timeout_ms terminate var_exitcode | |||
Timeout::ExecTimeout '${commandline}' '${timeout_ms}' '${terminate}' | |||
Pop ${var_exitcode} | |||
!macroend | |||
!define ExecTimeout "!insertmacro ExecTimeout"</highlight-nsis> | |||
== Example == | == Example == | ||
Here is a simple example of how to use ExecTimeout: | |||
<highlight-nsis>Name "TestTimeout" | <highlight-nsis>Name "TestTimeout" | ||
Line 31: | Line 46: | ||
DetailPrint "Exit Code: $0" | DetailPrint "Exit Code: $0" | ||
SectionEnd</highlight-nsis> | SectionEnd</highlight-nsis> | ||
== Download == | == Download == |
Revision as of 22:05, 1 July 2008
Description
This is a simple plugin that will execute an application and wait for the process to exit, just like the ExecWait command. But in contrast to ExecWait you can specify a timeout. If the application does not exit before the timeout exceeds, the control will return to the installer. This can be used to make sure your installer won't stall, even if the application doesn't exit for some reason. You can either terminate the application on timeout or leave it alone.
Usage
This is the syntax of ExecTimeout:
Usage: ${ExecTimeout} <Commandline> <Timeout> <Terminate> <Var ExitCode> Arguments: <Commandline> should contain the path to the executable file [string] <Timeout> specifies the timeout in milliseconds [integer] <Terminate> specifies whether the process will be terminated on timeout [0|1] Return Value: <ExitCode> will return the exit code of the application, "timeout" or "error"
Includes
Include this in your script to use the ExecTimeout plugin.
!macro ExecTimeout commandline timeout_ms terminate var_exitcode Timeout::ExecTimeout '${commandline}' '${timeout_ms}' '${terminate}' Pop ${var_exitcode} !macroend !define ExecTimeout "!insertmacro ExecTimeout"
Example
Here is a simple example of how to use ExecTimeout:
Name "TestTimeout" OutFile "TestTimeout.exe" ShowInstDetails show Section MessageBox MB_ICONINFORMATION "I will start Notepad now. It will time out after 5 seconds!" DetailPrint 'Executing: "$WINDIR\Notepad.exe"' ${ExecTimeout} '"$WINDIR\Notepad.exe"' 5000 1 $0 DetailPrint "Exit Code: $0" SectionEnd
Download
ExecTimeout.2008-07-01.zip not found