public class SystemCommand extends Object
Modifier and Type | Field and Description |
---|---|
static int |
POLL_INTERVAL
Deprecated.
does not make sense anymore. Superseded by
Object.wait(long) |
Constructor and Description |
---|
SystemCommand(File directory,
long timeoutMillis,
int pollInterval,
Map<String,String> env,
InputStream stdin,
OutputStream stdout,
OutputStream stderr) |
SystemCommand(File directory,
long timeoutMillis,
int pollInterval,
Map<String,String> env,
String stdin,
String stdout,
String stderr) |
SystemCommand(File directory,
Map<String,String> env) |
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
getExecutionEnvironment() |
String |
getOutResult() |
int |
run(List<String> arguments) |
int |
run(List<String> arguments1,
List<String> arguments2)
Pipe the output of one command into another
|
@Deprecated public static final int POLL_INTERVAL
Object.wait(long)
public SystemCommand(File directory, Map<String,String> env)
env
- Environment variables appended to environment (may be null)directory
- File working directory (may be null)public SystemCommand(File directory, long timeoutMillis, int pollInterval, Map<String,String> env, String stdin, String stdout, String stderr) throws IOException
env
- Environment variables appended to environment (may be null)directory
- File working directory (may be null)timeoutMillis
- timeout in MillisecondspollInterval
- Value used to poll for Process execution endstdin
- File name that will contain data to be input to process (may be null)stdout
- File name that will contain out stream (may be null)stderr
- File name that will contain err stream (may be null)IOException
- if the input file is not found or output cannot be writtenpublic SystemCommand(File directory, long timeoutMillis, int pollInterval, Map<String,String> env, InputStream stdin, OutputStream stdout, OutputStream stderr)
env
- Environment variables appended to environment (may be null)directory
- File working directory (may be null)timeoutMillis
- timeout in MillisecondspollInterval
- not used anymorestdin
- File name that will contain data to be input to process (may be null)stdout
- File name that will contain out stream (may be null)stderr
- File name that will contain err stream (may be null)public int run(List<String> arguments) throws InterruptedException, IOException, TimeoutException
arguments
- List of strings, not nullInterruptedException
- when execution was interruptedIOException
- when I/O error occurs while executionTimeoutException
- when timeout is reached while executionpublic int run(List<String> arguments1, List<String> arguments2) throws InterruptedException, IOException, TimeoutException
arguments1
- first command to runarguments2
- second command to runInterruptedException
- when execution gets interruptedTimeoutException
- when timeout is reached while executionIOException
- when I/O error occurs while executionpublic String getOutResult()
Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.