From 6e9d415e1e324600c633d070ef54a9fc9f7e597d Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 29 Oct 2003 15:02:43 +0000 Subject: [PATCH] timeout should result in build failure. PR: 24170 Submitted by: Edwin Steele git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275583 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/taskdefs/optional/ssh/SSHExec.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java index 8489cd03e..8fda328c7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java @@ -209,7 +209,11 @@ public class SSHExec extends SSHBase { if (thread.isAlive()) { // ran out of time thread = null; - log(TIMEOUT_MESSAGE, Project.MSG_ERR); + if (getFailonerror()) { + throw new BuildException(TIMEOUT_MESSAGE); + } else { + log(TIMEOUT_MESSAGE, Project.MSG_ERR); + } } else { // completed successfully if (outputProperty != null) { @@ -235,7 +239,11 @@ public class SSHExec extends SSHBase { throw e; } catch (JSchException e) { if (e.getMessage().indexOf("session is down") >= 0) { - log(TIMEOUT_MESSAGE, Project.MSG_ERR); + if (getFailonerror()) { + throw new BuildException(TIMEOUT_MESSAGE, e); + } else { + log(TIMEOUT_MESSAGE, Project.MSG_ERR); + } } else { if (getFailonerror()) { throw new BuildException(e);