diff --git a/src/main/java/com/jcabi/ssh/Shell.java b/src/main/java/com/jcabi/ssh/Shell.java index f948d38..94b6362 100644 --- a/src/main/java/com/jcabi/ssh/Shell.java +++ b/src/main/java/com/jcabi/ssh/Shell.java @@ -103,7 +103,7 @@ public int exec(final String command, final InputStream stdin, final int exit = this.origin.exec(command, stdin, stdout, stderr); if (exit != 0) { throw new IllegalArgumentException( - String.format("exit code #%d: %s", exit, command) + String.format("non-zero exit code #%d: %s", exit, command) ); } return exit; diff --git a/src/test/java/com/jcabi/ssh/SSHDTest.java b/src/test/java/com/jcabi/ssh/SSHDTest.java index d64bf1e..85ce3ca 100644 --- a/src/test/java/com/jcabi/ssh/SSHDTest.java +++ b/src/test/java/com/jcabi/ssh/SSHDTest.java @@ -72,7 +72,9 @@ public void executeCommandOnServer() throws Exception { final SSHD sshd = new SSHD(this.temp.newFolder()); try { MatcherAssert.assertThat( - new Shell.Plain(sshd.connect()).exec("echo one"), + new Shell.Plain( + new Shell.Safe(sshd.connect()) + ).exec("echo one"), Matchers.startsWith("one") ); } finally { @@ -90,9 +92,11 @@ public void executeCommandOnServerWithManualConfig() throws Exception { try { MatcherAssert.assertThat( new Shell.Plain( - new SSH( - sshd.host(), sshd.port(), sshd.login(), - this.getClass().getResource("id_rsa") + new Shell.Safe( + new SSH( + sshd.host(), sshd.port(), sshd.login(), + this.getClass().getResource("id_rsa") + ) ) ).exec("echo 'how are you'"), Matchers.startsWith("how are")