public interface CommandFuture extends ListenableFuture<CommandResult>
ListenableFuture
that provides access to the output and exit status
of an asynchronous command.
This future is resolved when its command terminates, either successfully or
with an error. If the command completes successfully, get
returns a CommandResult
containing the exit status and any
unread content from the output and error streams. If the command
terminates with an error, get
throws an ExecutionException
whose cause is either an IOException
or a runtime exception.
Calling cancel(true)
makes a best-effort attempt to
terminate a running command. The exact behavior of this method is
system-dependent.
Clients can read output from or send input to the command process at any time before the process terminates using the streams provided by this future. Closing these streams has no effect on the process and they are closed automatically when the process terminates.
Modifier and Type | Method and Description |
---|---|
InputStream |
getStdErr()
Returns the command process's standard error stream.
|
OutputStream |
getStdIn()
Returns the command process's standard input stream.
|
InputStream |
getStdOut()
Returns the command process's standard output stream.
|
addListener
InputStream getStdOut()
Closing this stream has no effect on the process and it is closed
automatically when the process terminates. Any content read from this
stream will not be available in the CommandResult
returned by
this future.
InputStream getStdErr()
Closing this stream has no effect on the process and it is closed
automatically when the process terminates. Any content read from this
stream will not be available in the CommandResult
returned by
this future.
OutputStream getStdIn()
Closing this stream has no effect on the process and it is closed automatically when the process terminates.