@Immutable public interface Shell
This interface is implemented by Ssh
class. In order to use
it, just make an instance and call
exec(String,InputStream,OutputStream,OutputStream)
exec()}:
String hello = new Shell.Plain( new SSH( "ssh.example.com", 22, "yegor", "-----BEGIN RSA PRIVATE KEY-----..." ) ).exec("echo 'Hello, world!'");
Modifier and Type | Interface and Description |
---|---|
static class |
Shell.Empty
Without input and output.
|
static class |
Shell.Fake
Fake shell for unit testing.
|
static class |
Shell.Plain
With output only.
|
static class |
Shell.Safe
Safe run (throws if exit code is not zero).
|
static class |
Shell.Verbose
Verbose run.
|
Modifier and Type | Method and Description |
---|---|
int |
exec(String command,
InputStream stdin,
OutputStream stdout,
OutputStream stderr)
Execute and return exit code.
|
int exec(String command, InputStream stdin, OutputStream stdout, OutputStream stderr) throws IOException
command
- Commandstdin
- Stdin (will be closed)stdout
- Stdout (will be closed)stderr
- Stderr (will be closed)IOException
- If failsCopyright © 2012–2017 jcabi.com. All rights reserved.