Package pl.poznan.put.utility
Class ExecHelper
java.lang.Object
pl.poznan.put.utility.ExecHelper
- Direct Known Subclasses:
ImmutableExecHelper
An executor of external processes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A result of running external command. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ExecHelper
public ExecHelper()
-
-
Method Details
-
createRandomDirectory
Generates a random name and creates a directory named like that in system temporary directory.- Returns:
- A path to the created directory.
- Throws:
IOException
- When it was impossible to create the random directory.
-
workingDirectory
- Returns:
- The working directory where to run the command in.
-
command
- Returns:
- The command to run.
-
execute
Executes the command in a working directory (if provided) with environment setting (if provided).- Returns:
- An object containing exit code with standard output and error streams.
- Throws:
IOException
- When it was impossible to run the external command.
-
environment
- Returns:
- The environment variables to be set during external command running (default: empty).
-
arguments
- Returns:
- The list of arguments to the command (default: empty).
-