Local process Plugin - Execute Macros¶
Contents :
- # EXECUTE $({command_content}) LOCALLY AS {result}
- # EXECUTE $({command_content}) LOCALLY AS {result} WITHIN {timeout} ms
- # EXECUTE SCRIPT {command_content} LOCALLY AS {result}
- # EXECUTE SCRIPT {command_content} LOCALLY AS {result} WITHIN {timeout_in_seconds} s
- # EXECUTE SCRIPT {command_content} LOCALLY AS {result} WITH STREAMLENGTH {length}
- # EXECUTE SCRIPT {command_content} LOCALLY AS {result} WITH STREAMLENGTH {length} WITHIN {timeout_in_seconds} s
# EXECUTE $({command_content}) LOCALLY AS {result}¶
What ?
This macro will execute an inline command on the local system and check if the result is a success.
Underlying instructions :
DEFINE $({command_content}) AS __command{%%rand1}
CONVERT __command{%%rand1} TO query.shell AS __commandLine{%%rand2}
EXECUTE local WITH __commandLine{%%rand2} AS {result}
ASSERT {result} IS success
> Input :
{command_content}
: The shell command to execute, preceded by a call to the shell (“cmd.exe /C” for Windows, “/bin/sh -c” for Linux).
> Output :
{result}
: The name of the resource which references the result of the command (result.shell
type resource).
Example :
# EXECUTE $(cmd.exe /C echo “hello world”) LOCALLY AS result |
# EXECUTE $({command_content}) LOCALLY AS {result} WITHIN {timeout} ms¶
What ?
This macro will execute an inline command on the local system, within a timeframe, and check if the result is a success.
Underlying instructions :
DEFINE $({command_content}) AS __command{%%rand1}
CONVERT __command{%%rand1} TO query.shell AS __commandLine{%%rand2} USING $(timeout:{timeout})
EXECUTE local WITH __commandLine{%%rand2} AS {result}
ASSERT {result} IS success
> Input :
{command_content}
: The shell command to execute, preceded by a call to the shell (“cmd.exe /C” for Windows, “/bin/sh -c” for Linux).{timeout}
: Maximal time authorized for the command execution (in milliseconds).
> Output :
{result}
: The name of the resource which references the result of the command (result.shell
type resource).
Example :
# EXECUTE $(cmd.exe /C echo “hello world”) LOCALLY AS result WITHIN 15000 ms |
# EXECUTE SCRIPT {command_content} LOCALLY AS {result}¶
What ?
This macro will execute a script on the local system and check if the result is a success.
Underlying instructions :
LOAD {command_content} AS __command{%%rand1}
CONVERT __command{%%rand1} TO query.shell AS __commandLine{%%rand2}
EXECUTE local WITH __commandLine{%%rand2} AS {result}
ASSERT {result} IS success
> Input :
{command_content}
: The script file containing the shell commands to execute, preceded by a call to the shell (“cmd.exe /C” for Windows, “/bin/sh -c” for Linux).
> Output :
{result}
: The name of the resource which references the result of the command (result.shell
type resource).
Example :
# EXECUTE SCRIPT command.bat LOCALLY AS result File to process (Windows) :
The folder containing the resources to process :
SKF script :
# EXECUTE SCRIPT {command_content} LOCALLY AS {result} WITHIN {timeout_in_seconds} s¶
What ?
This macro will execute a script on the local system, within a timeframe, and check if the result is a success.
Underlying instructions :
LOAD {command_content} AS __command{%%rand1}
CONVERT __command{%%rand1} TO query.shell USING $(timeout:{timeout_in_seconds}000) AS __commandLine{%%rand2}
EXECUTE local WITH __commandLine{%%rand2} AS {result}
ASSERT {result} IS success
> Input :
{command_content}
: The script file containing the shell commands to execute, preceded by a call to the shell (“cmd.exe /C” for Windows, “/bin/sh -c” for Linux).{timeout_in_seconds}
: Maximal time authorized for the command execution (in seconds).
> Output :
{result}
: The name of the resource which references the result of the command (result.shell
type resource).
Example :
# EXECUTE SCRIPT command.bat LOCALLY AS result WITHIN 5 s File to process (Windows) :
The folder containing the resources to process :
SKF script :
# EXECUTE SCRIPT {command_content} LOCALLY AS {result} WITH STREAMLENGTH {length}¶
What ?
This macro will execute a script on the local system, with the length of the stream specified, and check if the result is a success.
Underlying instructions :
LOAD {command_content} AS __command{%%rand1}
CONVERT __command{%%rand1} TO query.shell USING $(streamlength:{length}) AS __commandLine{%%rand2}
EXECUTE local WITH __commandLine{%%rand2} AS {result}
ASSERT {result} IS success
> Input :
{command_content}
: The script file containing the shell commands to execute, preceded by a call to the shell (“cmd.exe /C” for Windows, “/bin/sh -c” for Linux).{length}
: An integer that represents stream length (number of characters). Specifying “full” allows to have the entire stream.
> Output :
{result}
: The name of the resource which references the result of the command (result.shell
type resource).
Example :
# EXECUTE SCRIPT command.bat LOCALLY AS result WITH STREAMLENGTH 200 File to process (Windows), with an error :
The folder containing the resources to process :
SKF script :
Warning
Streamlength (with a value of n) will shorten both the STDOUT and the STDERR, keeping only the n last characters, possibly rendering the debug harder :
# EXECUTE SCRIPT {command_content} LOCALLY AS {result} WITH STREAMLENGTH {length} WITHIN {timeout_in_seconds} s¶
What ?
This macro will execute a script on the local system, with the length of the stream specified and within a timeframe, and check if the result is a success.
Underlying instructions :
LOAD {command_content} AS __command{%%rand1}
CONVERT __command{%%rand1} TO query.shell USING $(timeout:{timeout_in_seconds}000, streamlength:{length}) AS __commandLine{%%rand2}
EXECUTE local WITH __commandLine{%%rand2} AS {result}
ASSERT {result} IS success
> Input :
{command_content}
: The script file containing the shell commands to execute, preceded by a call to the shell (“cmd.exe /C” for Windows, “/bin/sh -c” for Linux).{length}
: An integer that represents stream length (number of characters). Specifying “full” allows to have the entire stream.{timeout_in_seconds}
: Maximal time authorized for the command execution (in seconds).
> Output :
{result}
: The name of the resource which references the result of the command (result.shell
type resource).
Example :
# EXECUTE SCRIPT command.bat LOCALLY AS result WITH STREAMLENGTH 200 WITHIN 5 s File to process (Windows), with an error :
The folder containing the resources to process :
SKF script :
Warning
Streamlength (with a value of n) will shorten both the STDOUT and the STDERR, keeping only the n last characters, possibly rendering the debug harder :