Package org.eclipse.jgit.transport
Class JschSession.JschProcess
java.lang.Object
java.lang.Process
org.eclipse.jgit.transport.JschSession.JschProcess
- Enclosing class:
JschSession
Implementation of Process for running a single command using Jsch.
Uses the Jsch session to do actual command execution and manage the execution.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.jcraft.jsch.ChannelExec
private InputStream
private InputStream
private OutputStream
(package private) final int
-
Constructor Summary
ConstructorsConstructorDescriptionJschProcess
(String commandName, Map<String, String> environment, int tms) Opens a channel on the session ("sock") for executing the given command, opens streams, and starts command execution. -
Method Summary
Methods inherited from class java.lang.Process
destroyForcibly, isAlive, waitFor
-
Field Details
-
channel
private com.jcraft.jsch.ChannelExec channel -
timeout
final int timeout -
inputStream
-
outputStream
-
errStream
-
-
Constructor Details
-
JschProcess
JschProcess(String commandName, Map<String, String> environment, int tms) throws TransportException, IOExceptionOpens a channel on the session ("sock") for executing the given command, opens streams, and starts command execution.- Parameters:
commandName
- the command to executeenvironment
- environment variables to pass ontms
- the timeout value, in seconds, for the command.- Throws:
TransportException
- on problems opening a channel or connecting to the remote hostIOException
- on problems opening streams
-
-
Method Details
-
closeOutputStream
private void closeOutputStream() -
setupStreams
- Throws:
IOException
-
getInputStream
- Specified by:
getInputStream
in classProcess
-
getOutputStream
- Specified by:
getOutputStream
in classProcess
-
getErrorStream
- Specified by:
getErrorStream
in classProcess
-
exitValue
public int exitValue() -
isRunning
private boolean isRunning() -
destroy
public void destroy() -
waitFor
- Specified by:
waitFor
in classProcess
- Throws:
InterruptedException
-