// connect actually execs the process on a remote node
channel.connect();
// synchronously consume the stdout. If no stdout is available
// this method exits.
consumeProcessStream(host, in, outputStream, channel);
channel.disconnect();
if ( channel.getExitStatus() != 0 || errorStream.size() > 0 ) {
result = new ProcessCompletionResult(channel.getExitStatus(), host, command, new String(errorStream.toByteArray()));
} else {
result = new ProcessCompletionResult(channel.getExitStatus(), host, command);
}