system
Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center?Ā Click hereĀ !
Availability
This routine is available starting with katl-commons 1.0.
Not available on cloud.
Syntax
system(command)
Description
Executes the command command of the operating system.Returns the exit code of the program and the output and error streams as strings. Through this you may integrate outside scripts (sh, ksh, perl, ...) with Jira. Streams are limited to 4Kb (only the first 4Kb are taken into account).
Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
command | string | yes | Valid Operating System command. |
Returns
string []
The routine returns an array with 3 elements in such order:
- The operating system exit code of the process being spawned (as string)
- The output stream (limited to 4Kb) as a string
- The error stream (limited to 4Kb) as a string
Example
Let's create a file using system routine and windows command prompt:
string testfolder="c:/tests"; //assuming that foler `tests` has been already created in c:\ path system("C:/WINDOWS/system32/cmd.exe /c echo return true; > " + testfolder + "qqq.sil"); // you can run here any other program or custom script
Let's invoke a windows .bat script file using system routine:
string testfolder="c:/tests/"; //assuming this path exists. //we assume in this path a file called `myexec.bat` has been previously created and contains one line `echo Hello;` //now the following call will return `0.0|[THE_PATH_OF_EXECUTION]>echo Hello; Hello;|` return system("C:/WINDOWS/system32/cmd.exe /c " + testfolder + "myexec.bat");
For windows operating system, you should put the full (absolute) path of the command.
See also