public class CommandRunner.ChannelExecWrapper extends Object
getXxxStream() for the streams you want to work with, which
will return an opened stream. Use the stream as needed then call
close() on the ChannelExecWrapper
itself, which will return the the exit code from the execution of the
command.| Constructor and Description |
|---|
ChannelExecWrapper(com.jcraft.jsch.Session session,
String command,
InputStream stdIn,
OutputStream stdOut,
OutputStream stdErr) |
| Modifier and Type | Method and Description |
|---|---|
int |
close()
Safely closes all stream, waits for the underlying connection to close,
then returns the exit code from the command execution.
|
InputStream |
getErrStream()
Returns the STDERR stream for you to read from.
|
InputStream |
getInputStream()
Returns the STDOUT stream for you to read from.
|
OutputStream |
getOutputStream()
Returns the STDIN stream for you to write to.
|
public ChannelExecWrapper(@Nonnull com.jcraft.jsch.Session session, @Nonnull String command, @Nullable InputStream stdIn, @Nullable OutputStream stdOut, @Nullable OutputStream stdErr) throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchExceptionpublic int close()
public InputStream getErrStream() throws IOException
close();IOException - If unable to read from the streampublic InputStream getInputStream() throws IOException
close();IOException - If unable to read from the streampublic OutputStream getOutputStream() throws IOException
close();IOException - If unable to write to the streamCopyright © 2020 Philip Helger. All rights reserved.