Simplified StandardOutReader.
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/fd6e0a0b Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/fd6e0a0b Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/fd6e0a0b Branch: refs/heads/master Commit: fd6e0a0be55ca20e811a8b6ccd4288d8ce330eae Parents: a3487e7 Author: shamrath <[email protected]> Authored: Sun May 10 16:15:30 2015 -0400 Committer: shamrath <[email protected]> Committed: Sun May 10 16:15:30 2015 -0400 ---------------------------------------------------------------------- .../apache/airavata/gsi/ssh/impl/StandardOutReader.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/fd6e0a0b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java ---------------------------------------------------------------------- diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java index 00cbe01..767fc61 100644 --- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java +++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java @@ -40,22 +40,14 @@ public class StandardOutReader implements CommandOutput { public void onOutput(Channel channel) { try { StringBuffer pbsOutput = new StringBuffer(""); -// try { -// Thread.sleep(1000); -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } InputStream inputStream = channel.getInputStream(); byte[] tmp = new byte[1024]; - while (true) { + while (!channel.isClosed()) { while (inputStream.available() > 0) { int i = inputStream.read(tmp, 0, 1024); if (i < 0) break; pbsOutput.append(new String(tmp, 0, i)); } - if (channel.isClosed()) { - break; - } } String output = pbsOutput.toString(); this.setStdOutputString(output);
