Package com.logicaldoc.core.automation

# Class SystemTool

java.lang.Object
com.logicaldoc.core.automation.SystemTool

public class SystemTool extends Object
Utility functions for interacting with the Operative System from within the Automation

Since:
  7.5.1
Author:
  Marco Meschieri - LogicalDOC

## Constructor Summary

Constructors
Constructor
Description
`SystemTool()`

## Method Summary

Modifier and Type
Method
Description
`int`
`exec(String commandline)`
Executes a command
`int`
`exec(String commandline, String path)`
Executes a command
`int`
`exec(List<String> commandLine, List<String> env, String path, int timeout)`
Executes the command
`String`
`execGetOutput(String commandline)`
Executes a command and gets it's output.
`String`
`execGetOutput(String commandline, String path)`
Executes a command and gets it's output
`String`
`execGetOutput(List<String> commandLine, List<String> env, String path, int timeout)`
Executes the command and gets it's output

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SystemTool

public SystemTool()

## Method Details

### execGetOutput

public String execGetOutput(String commandline) throws IOException
Executes a command and gets it's output. The path of the command must be listed in the allowed-commands.txt

Parameters:
  `commandline` - the command to execute
Returns:
  the output of the command
Throws:
  `IOException` - error executing the command or command not found

### execGetOutput

public String execGetOutput(String commandline, String path) throws IOException
Executes a command and gets it's output

Parameters:
  `commandline` - the command to execute. The path of the command must be listed in the allowed-commands.txt
  `path` - the path to set as current folder before executing the command
Returns:
  the output of the command
Throws:
  `IOException` - error executing the command or command not found

### exec

public int exec(String commandline) throws IOException
Executes a command

Parameters:
  `commandline` - the command to execute. The path of the command must be listed in the allowed-commands.txt
Returns:
  the execution's result
Throws:
  `IOException` - error executing the command or command not found

### exec

public int exec(String commandline, String path) throws IOException
Executes a command

Parameters:
  `commandline` - the command to execute. The path of the command must be listed in the allowed-commands.txt
  `path` - the path to set as current folder before executing the command
Returns:
  the execution's result
Throws:
  `IOException` - error executing the command or command not found

### exec

public int exec(List<String> commandLine, List<String> env, String path, int timeout) throws IOException
Executes the command

Parameters:
  `commandLine` - the list of elements in the command line. The path of the command must be listed in the allowed-commands.txt
  `env` - the environment variables
  `path` - the path to set as current folder before executing the command
  `timeout` - maximum execution time expressed in seconds
Returns:
  the return code of the command
Throws:
  `IOException` - error executing the command or command not found

### execGetOutput

public String execGetOutput(List<String> commandLine, List<String> env, String path, int timeout) throws IOException
Executes the command and gets it's output

Parameters:
  `commandLine` - the list of elements in the command line. The path of the command must be listed in the allowed-commands.txt
  `env` - the environment variables
  `path` - the path to set as current folder before executing the command
  `timeout` - maximum execution time expressed in seconds
Returns:
  the output of the command
Throws:
  `IOException` - error executing the command or command not found