Browse Source

Added failonError attribute.

Submitted By: Iulian Musat <iulian@3dgeo.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269077 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
18ea21ee7d
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      src/main/org/apache/tools/ant/taskdefs/Cvs.java

+ 15
- 1
src/main/org/apache/tools/ant/taskdefs/Cvs.java View File

@@ -121,6 +121,13 @@ public class Cvs extends Task {
*/
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 @@ public class Cvs extends Task {
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 {
@@ -284,6 +294,10 @@ public class Cvs extends Task {
public void setError(File error) {
this.error = error;
}

public void setFailOnError(boolean failOnError) {
this.failOnError = failOnError;
}
}



Loading…
Cancel
Save