public final class RunnableProcess extends Object implements Runnable
Constructor and Description |
---|
RunnableProcess(List<String> command,
String id,
File folder,
RunnableProcessObserver processObserver,
String standardOutFileName,
String standardErrorFileName) |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the running process if it is running.
|
static List<String> |
expandEnvironmentVariables(List<String> command)
Replace {{ENV_VAR}} placeholders with the values of the corresponding environment variables.
|
static String |
expandEnvironmentVariables(String command)
Replace {{ENV_VAR}} placeholders with the values of the corresponding environment variables.
|
List<String> |
getCommand() |
String |
getId() |
void |
run()
Runs the configured process.
|
public RunnableProcess(List<String> command, String id, File folder, RunnableProcessObserver processObserver, String standardOutFileName, String standardErrorFileName)
command
- the command to execute.id
- The ID of the process. This is used to name files and in the logs created by this process.folder
- The folder in which this will store its stdout and stderr outputprocessObserver
- will be informed of process state changes.standardOutFileName
- The name of the file used for redirecting STDOUTstandardErrorFileName
- The name of the file used for redirecting STDERRpublic static String expandEnvironmentVariables(String command)
command
- An input string with {{ENV_VAR}} placeholders
to be replaced with the values of the corresponding environment variables.
Replace unknown/unset variables with an empty string.public static List<String> expandEnvironmentVariables(List<String> command)
command
- An input list of strings with {{ENV_VAR}} placeholders
to be replaced with the values of the corresponding environment variables.
Replace unknown/unset variables with an empty string.public void run()
run
in interface Runnable
IllegalStateException
- if the process is already running or has been running before.public void cancel()
public List<String> getCommand()
Copyright © 2017 The Apache Software Foundation. All rights reserved.