runSshCommand
public static String runSshCommand(URIish sshUri,
@Nullable
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 - the SSH remote URI
provider - the CredentialsProvider or null.
fs - the FS implementation passed to
SshSessionFactory
command - the remote command to execute.
timeout - a timeout in seconds. The timeout may be exceeded in corner
cases.
- Returns:
- The entire output read from stdout.
- Throws:
IOException
CommandFailedException - if the ssh command execution failed, error message contains
the content of stderr.