diff options
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java index 913aa72867..ac5be1bf20 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java @@ -94,6 +94,7 @@ public class SshSupport { CommandFailedException failure = null; @SuppressWarnings("resource") MessageWriter stderr = new MessageWriter(); + String out; try (MessageWriter stdout = new MessageWriter()) { session = SshSessionFactory.getInstance().getSession(sshUri, provider, fs, 1000 * timeout); @@ -108,12 +109,12 @@ public class SshSupport { // waitFor with timeout has a bug - JSch' exitValue() throws the // wrong exception type :( if (process.waitFor() == 0) { - return stdout.toString(); + out = stdout.toString(); } else { - return null; // still running after timeout + out = null; // still running after timeout } } catch (InterruptedException e) { - return null; // error + out = null; // error } } finally { if (errorThread != null) { @@ -147,10 +148,11 @@ public class SshSupport { if (session != null) { SshSessionFactory.getInstance().releaseSession(session); } - if (failure != null) { - throw failure; - } } + if (failure != null) { + throw failure; + } + return out; } } |