Class JschSession.JschProcess
java.lang.Object
java.lang.Process
org.eclipse.jgit.transport.ssh.jsch.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.ChannelExecprivate InputStreamprivate InputStreamprivate 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
children, descendants, destroyForcibly, errorReader, errorReader, info, inputReader, inputReader, isAlive, onExit, outputWriter, outputWriter, pid, supportsNormalTermination, toHandle, 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:
getInputStreamin classProcess
-
getOutputStream
- Specified by:
getOutputStreamin classProcess
-
getErrorStream
- Specified by:
getErrorStreamin classProcess
-
exitValue
public int exitValue() -
isRunning
private boolean isRunning() -
destroy
public void destroy() -
waitFor
- Specified by:
waitForin classProcess- Throws:
InterruptedException
-