Skip to content
Snippets Groups Projects
Commit cb78b601 authored by tjc's avatar tjc
Browse files

updates

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@6301 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 2477d575
No related branches found
No related tags found
No related merge requests found
......@@ -128,9 +128,7 @@ public class SshPSUClient extends Thread
public void run()
{
String program = cmd;
boolean completed = false;
try
{
......@@ -568,21 +566,26 @@ public class SshPSUClient extends Thread
{
// make sure we hang around for stdout
while(stdouth.isAlive() || stderrh.isAlive())
Thread.sleep(5);
Thread.sleep(2);
}
catch(InterruptedException ie)
{
ie.printStackTrace();
}
// stdout & stderr
//logger4j.debug("STDOUT \n"+stdouth.getOutput());
if(!stderrh.getOutput().equals(""))
if(stderrh.getBufferSize() > 0)
logger4j.debug("STDERR :"+stderrh.getOutput());
session.close();
return true;
}
public StringBuffer getStdOutBuffer()
{
return stdouth.getStdOutBuffer();
}
public String getStdOut()
{
......@@ -652,8 +655,8 @@ public class SshPSUClient extends Thread
private boolean isStdout;
private StringBuffer buff = new StringBuffer();
protected StdoutStdErrHandler(SessionChannelClient session,
boolean isStdout)
protected StdoutStdErrHandler(final SessionChannelClient session,
final boolean isStdout)
{
this.session = session;
this.isStdout = isStdout;
......@@ -669,7 +672,7 @@ public class SshPSUClient extends Thread
else
in = session.getStderrInputStream();
byte buffer[] = new byte[100];
final byte buffer[] = new byte[400];
int read;
while((read = in.read(buffer)) > 0)
buff.append(new String(buffer, 0, read));
......@@ -681,12 +684,21 @@ public class SshPSUClient extends Thread
ioe.printStackTrace();
}
}
public synchronized StringBuffer getStdOutBuffer()
{
return buff;
}
public synchronized String getOutput()
{
return buff.toString();
}
public int getBufferSize()
{
return buff.length();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment