donaldp 01/05/31 21:50:43
Modified: src/main/org/apache/tools/ant/taskdefs Cvs.java
Log:
Added failonError attribute.
Submitted By: Iulian Musat <[EMAIL PROTECTED]>
Revision Changes Path
1.15 +15 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java
Index: Cvs.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Cvs.java 2001/04/27 11:52:54 1.14
+++ Cvs.java 2001/06/01 04:50:42 1.15
@@ -121,6 +121,13 @@
*/
private File error;
+ /**
+ * If true it will stop the build if cvs exits with error.
+ * Default is false. (Iulian)
+ */
+ private boolean failOnError = false;
+
+
public void execute() throws BuildException {
// XXX: we should use JCVS (www.ice.com/JCVS) instead of command line
@@ -206,7 +213,10 @@
exe.setCommandline(toExecute.getCommandline());
exe.setEnvironment(env.getVariables());
try {
- exe.execute();
+ int retCode = exe.execute();
+ /*Throw an exception if cvs exited with error. (Iulian)*/
+ if(failOnError && retCode != 0)
+ throw new BuildException("cvs exited with error code "+
retCode);
} catch (IOException e) {
throw new BuildException(e, location);
} finally {
@@ -283,6 +293,10 @@
public void setError(File error) {
this.error = error;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
}
}