Class LocalProcessClient
java.lang.Object
org.opentestfactory.utils.process.LocalProcessClient
Client responsible to deal with the local system in process executing
- Author:
- cruhlmann, bfranchet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionrunLocalProcessCommand(String command, File workingDir, Integer timeout, Integer streamlength) This method execute a single command line on the local system.setEnvironmentVariable(String name, String value) Convenience method to set one variable.setEnvironmentVariables(Map<String, String> variables) Method to set a bunch of environement variables.booleanConvenience method to remove a single variable from the environment.unsetEnvironmentVariables(Set<String> targetVariables) Remove some variables from the run environement.
-
Constructor Details
-
LocalProcessClient
public LocalProcessClient()
-
-
Method Details
-
unsetEnvironementVariable
Convenience method to remove a single variable from the environment.- Parameters:
name- the name of the target variable.- Returns:
trueif the variable existed,falseotherwise.
-
unsetEnvironmentVariables
Remove some variables from the run environement.- Parameters:
targetVariables- names of the variables tpo unset.- Returns:
- name of the variables that were actually unset (only previously existing variables will be listed here).
-
setEnvironmentVariable
Convenience method to set one variable.- Parameters:
name- variable name.value-- Returns:
- the previous value if the variable was defined,
nullotherwise.
-
setEnvironmentVariables
Method to set a bunch of environement variables.- Parameters:
variables- the variable mappins to set.- Returns:
- returns a map of replaced values for vairables that were already defined.
-
runLocalProcessCommand
public ShellResult runLocalProcessCommand(String command, File workingDir, Integer timeout, Integer streamlength) throws IOException, InterruptedException, TimeoutException, ParseException This method execute a single command line on the local system.- Parameters:
command- The command to executeworkingDir- The working directory for the launched command. If set to null, the default working directory will be used.timeout- The timeout (in ms) before the process gets killed and you get shouted at. If set to 0 or a negative value, no timeout will be applied.streamlength- The max stream length to keep (number of characters).- Returns:
- a ShellResult
- Throws:
IOExceptionInterruptedExceptionTimeoutExceptionParseException
-