git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275258 13f79535-47bb-0310-9956-ffa450edef68master
@@ -518,7 +518,12 @@ public class ExecTask extends Task { | |||||
//test for and handle a forced process death | //test for and handle a forced process death | ||||
if (exe.killedProcess()) { | if (exe.killedProcess()) { | ||||
log("Timeout: killed the sub-process", Project.MSG_WARN); | |||||
String msg = "Timeout: killed the sub-process"; | |||||
if (failOnError) { | |||||
throw new BuildException(msg); | |||||
} else { | |||||
log(msg, Project.MSG_WARN); | |||||
} | |||||
} | } | ||||
maybeSetResultPropertyValue(returnCode); | maybeSetResultPropertyValue(returnCode); | ||||
if (Execute.isFailure(returnCode)) { | if (Execute.isFailure(returnCode)) { | ||||
@@ -569,8 +569,8 @@ public class Execute { | |||||
/** | /** | ||||
* Query the exit value of the process. | * Query the exit value of the process. | ||||
* @return the exit value, 1 if the process was killed, | |||||
* or Execute.INVALID if no exit value has been received | |||||
* @return the exit value or Execute.INVALID if no exit value has | |||||
* been received | |||||
*/ | */ | ||||
public int getExitValue() { | public int getExitValue() { | ||||
return exitValue; | return exitValue; | ||||
@@ -1153,4 +1153,4 @@ public class Execute { | |||||
} | } | ||||
} | } | ||||
} | |||||
} |
@@ -691,6 +691,9 @@ public class Java extends Task { | |||||
redirector.createStreams(); | redirector.createStreams(); | ||||
exe.execute(getProject()); | exe.execute(getProject()); | ||||
redirector.complete(); | redirector.complete(); | ||||
if (exe.killedProcess()) { | |||||
throw new BuildException("Timeout: killed the sub-process"); | |||||
} | |||||
} catch (IOException e) { | } catch (IOException e) { | ||||
throw new BuildException(e); | throw new BuildException(e); | ||||
} | } | ||||
@@ -728,10 +731,10 @@ public class Java extends Task { | |||||
exe.setCommandline(command); | exe.setCommandline(command); | ||||
try { | try { | ||||
int rc = exe.execute(); | int rc = exe.execute(); | ||||
redirector.complete(); | |||||
if (exe.killedProcess()) { | if (exe.killedProcess()) { | ||||
log("Timeout: killed the sub-process", Project.MSG_WARN); | |||||
throw new BuildException("Timeout: killed the sub-process"); | |||||
} | } | ||||
redirector.complete(); | |||||
return rc; | return rc; | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
throw new BuildException(e, getLocation()); | throw new BuildException(e, getLocation()); | ||||