Local process Plugin - Commands¶
Contents :
cleanup¶
What ?
It allows killing a processus, mainly for ecosystem environment management.
EXECUTE cleanup WITH <Res:process> AS $() |
> Input :
<Res:process>
: The name of the resource which references the processus to kill (process
type resource).
‘local’ ‘query.shell’¶
What ?
Command to execute a command line on the local system.
EXECUTE local WITH {query<Res:query.shell>} USING $(timeout:<n>,streamlength:<n’>) AS {result<Res:Result.shell>} |
> Input :
{query<Res:query.shell>}
: The name of the resource referencing a file which includes one (and one only) command line (query.shell
type resource).- <n> : An integer that represents time in milliseconds. It is the time the command execution will wait before crashing.
- <n’> : An integer that represents the stream length (number of characters). An option “full” allows to have the entire stream. It can be define via an inline instruction : $(streamlength : …). Streamlength property is available since 1.8.0 version.
Note 1 : If the timeout property is not defined here, we use the timeout property of query.shell
resource (set to 5s by default).
Note 2 : Be careful : Local process is not equivalent to a console, it only executes programs. So if you want to use it as a console, you should specify which shell you want to use in your command line. Most of the time :
- For windows, start your command line with : “cmd.exe /C” (first line).
- For linux, start your command with : /bin/sh -c (according to the distribution this may be useless).
Note 3 : As local process use the underlying OS, the TA scripts which use it are platform dependent.
Note 4 : if the streamlength property is not defined here, we use the streamlength property by default (set to 300 characters).
> Output :
{result<Res:result.shell>}
: The name of the resource which contains the shell command result (result.shell
type resource).
Example (Linux) :
DEFINE $(echo hello world) AS command.file CONVERT command.file TO query.shell USING $(timeout:15000, streamlength:600) AS commandLine EXECUTE local WITH commandLine AS result ASSERT result DOES contain WITH $(hello world) USING $(out) |
Note : To execute several command lines, you will need to execute a batch. You must then either give the absolute path of your batch or its relative path from your project’s root in the DEFINE instruction.
Example (Windows) :
LOAD command.bat AS command.file CONVERT command.file TO query.shell AS commandLine EXECUTE local WITH commandLine USING $(timeout:15000, streamlength:full) AS result ASSERT result DOES contain WITH $(hello world) USING $(out) ASSERT result DOES contain WITH $(nice day) USING $(out) |
command.bat :
cmd.exe /C
echo hello world
echo have a nice day