bodewig 2003/09/18 07:21:41
Modified: src/main/org/apache/tools/ant/taskdefs ExecTask.java
Execute.java Java.java
Log:
Treat timeout like a failed execution, fix comments on Execute#getExitCode
Revision Changes Path
1.61 +6 -1 ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
Index: ExecTask.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- ExecTask.java 13 Sep 2003 12:58:33 -0000 1.60
+++ ExecTask.java 18 Sep 2003 14:21:41 -0000 1.61
@@ -518,7 +518,12 @@
//test for and handle a forced process death
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);
if (Execute.isFailure(returnCode)) {
1.67 +4 -4 ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
Index: Execute.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- Execute.java 13 Sep 2003 12:58:33 -0000 1.66
+++ Execute.java 18 Sep 2003 14:21:41 -0000 1.67
@@ -569,8 +569,8 @@
/**
* 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() {
return exitValue;
@@ -1153,4 +1153,4 @@
}
}
-}
\ No newline at end of file
+}
1.76 +5 -2 ant/src/main/org/apache/tools/ant/taskdefs/Java.java
Index: Java.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- Java.java 16 Sep 2003 09:08:55 -0000 1.75
+++ Java.java 18 Sep 2003 14:21:41 -0000 1.76
@@ -691,6 +691,9 @@
redirector.createStreams();
exe.execute(getProject());
redirector.complete();
+ if (exe.killedProcess()) {
+ throw new BuildException("Timeout: killed the sub-process");
+ }
} catch (IOException e) {
throw new BuildException(e);
}
@@ -728,10 +731,10 @@
exe.setCommandline(command);
try {
int rc = exe.execute();
+ redirector.complete();
if (exe.killedProcess()) {
- log("Timeout: killed the sub-process", Project.MSG_WARN);
+ throw new BuildException("Timeout: killed the
sub-process");
}
- redirector.complete();
return rc;
} catch (IOException e) {
throw new BuildException(e, getLocation());
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]