if (server.equals(LOCAL)) {
p = Runtime.getRuntime().exec(cmdarray);
}
else {
SSHSocketImplFactory fac = SSHSocketImplFactory.getFactory(server);
p = fac.ssh(cmdToString(cmdarray));
}
//this should return as soon as connection is shutdown
int rc = p.waitFor();
if (rc != 0) {