Top Description Constructors Methods
org.eclipse.jgit.util

public Class SshSupport

extends Object
Class Inheritance
Imports
java.io.IOException, java.text.MessageFormat, java.util.concurrent.TimeUnit, org.eclipse.jgit.annotations.Nullable, org.eclipse.jgit.errors.CommandFailedException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.transport.CredentialsProvider, .RemoteSession, .SshSessionFactory, .URIish, org.eclipse.jgit.util.io.MessageWriter, .StreamCopyThread

Extra utilities to support usage of SSH.
Since
5.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static int
checkTimeout(String command, int timeout, long since)

public static String

Returns:

The entire output read from stdout.
runSshCommand
(URIish
the SSH remote URI
sshUri
,
CredentialsProvider
the CredentialsProvider or null.
provider
,
FS
the FS implementation passed to SshSessionFactory
fs
,
String
the remote command to execute.
command
,
int
a timeout in seconds. The timeout may be exceeded in corner cases.
timeout
)

Utility to execute a remote SSH command and read the first line of output.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SshSupportback to summary
public SshSupport()

Method Detail

checkTimeoutback to summary
private static int checkTimeout(String command, int timeout, long since) throws CommandFailedException
runSshCommandback to summary
public static String runSshCommand(URIish sshUri, CredentialsProvider provider, FS fs, String command, int timeout) throws IOException, CommandFailedException

Utility to execute a remote SSH command and read the first line of output.

Parameters
sshUri:URIish

the SSH remote URI

provider:CredentialsProvider

the CredentialsProvider or null.

fs:FS

the FS implementation passed to SshSessionFactory

command:String

the remote command to execute.

timeout:int

a timeout in seconds. The timeout may be exceeded in corner cases.

Returns:String

The entire output read from stdout.

Exceptions
IOException:
if an IO error occurred
CommandFailedException:
if the ssh command execution failed, error message contains the content of stderr.