Modifier and Type | Class and Description |
---|---|
static class |
Command.Result
Result data from an invocation
|
Modifier and Type | Method and Description |
---|---|
static Command.Result |
exec(String[] command)
Same as
exec(command, null, new byte[0]) . |
static Command.Result |
exec(String[] command,
byte[] stdin)
Same as
exec(command, null, stdin) . |
static Command.Result |
exec(String[] command,
File workingDir)
Same as
exec(command, workingDir, new byte[0]) . |
static Command.Result |
exec(String[] command,
File workingDir,
byte[] stdin)
Create process
command starting in the workingDir and
providing stdin as input. |
public static Command.Result exec(String[] command) throws IOException, InterruptedException
exec(command, null, new byte[0])
.command
- commandIOException
- if creating process failsInterruptedException
- if interruptedpublic static Command.Result exec(String[] command, File workingDir) throws IOException, InterruptedException
exec(command, workingDir, new byte[0])
.command
- commandworkingDir
- workingDirIOException
- if creating process failsInterruptedException
- if interruptedexec(String[], File, byte[])
public static Command.Result exec(String[] command, byte[] stdin) throws IOException, InterruptedException
exec(command, null, stdin)
.command
- commandstdin
- stdinIOException
- if creating process failsInterruptedException
- if interruptedexec(String[], File, byte[])
public static Command.Result exec(String[] command, File workingDir, byte[] stdin) throws IOException, InterruptedException
command
starting in the workingDir
and
providing stdin
as input. This method blocks until the process
exits. Stdout and stderr are available via Command.Result.getStdout()
and
Command.Result.getStderr()
. Before using them, however, you should generally
make sure that the process exited with a return code of zero, as other
return codes typically indicate an error.command
- commandworkingDir
- workingDirstdin
- stdinIOException
- if creating process failsInterruptedException
- if interrupted