|
|
@@ -65,6 +65,7 @@ import java.io.IOException; |
|
|
|
import java.io.StringReader; |
|
|
|
|
|
|
|
import com.jcraft.jsch.ChannelExec; |
|
|
|
import com.jcraft.jsch.JSchException; |
|
|
|
import com.jcraft.jsch.Session; |
|
|
|
|
|
|
|
/** |
|
|
@@ -93,6 +94,9 @@ public class SSHExec extends SSHBase { |
|
|
|
private File outputFile = null; // like <exec> |
|
|
|
private boolean append = false; // like <exec> |
|
|
|
|
|
|
|
private static final String TIMEOUT_MESSAGE = |
|
|
|
"Timeout period exceeded, connection dropped."; |
|
|
|
|
|
|
|
/** |
|
|
|
* Constructor for SSHExecTask. |
|
|
|
*/ |
|
|
@@ -205,7 +209,7 @@ public class SSHExec extends SSHBase { |
|
|
|
if (thread.isAlive()) { |
|
|
|
// ran out of time |
|
|
|
thread = null; |
|
|
|
log("Timeout period exceeded, connection dropped."); |
|
|
|
log(TIMEOUT_MESSAGE, Project.MSG_ERR); |
|
|
|
} else { |
|
|
|
// completed successfully |
|
|
|
if (outputProperty != null) { |
|
|
@@ -227,9 +231,19 @@ public class SSHExec extends SSHBase { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (BuildException e) { |
|
|
|
throw e; |
|
|
|
} catch (JSchException e) { |
|
|
|
if (e.getMessage().indexOf("session is down") >= 0) { |
|
|
|
log(TIMEOUT_MESSAGE, Project.MSG_ERR); |
|
|
|
} else { |
|
|
|
if (getFailonerror()) { |
|
|
|
throw new BuildException(e); |
|
|
|
} else { |
|
|
|
log("Caught exception: " + e.getMessage(), |
|
|
|
Project.MSG_ERR); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
if (getFailonerror()) { |
|
|
|
throw new BuildException(e); |
|
|
|