ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: [patch] Cvs task does not verify the exit code of cvs
Date Fri, 01 Jun 2001 05:03:01 GMT

And patched ;)

At 09:58 AM 5/31/01 -0700, Iulian Musat wrote:
>Done.
>
>Stefan Bodewig wrote:
>> 
>> Peter Donald <donaldp@apache.org> wrote:
>> 
>> > At 12:59 PM 5/30/01 -0700, Iulian Musat wrote:
>> >>If cvs exits with error you may want to stop the build.
>> >
>> > This actually looks good but it will break some build
>> > environments. WHat does everyone else think??  Cheers,
>> 
>> Throw in yet another failonerror attribute which defaults to false.
>> 
>> Stefan
>
>-- 
>Iulian Musat 
>3DGeo Development Inc.
>465 Fairchild Drive, Suite 226, Mountain View, CA 94043
>Tel: 650-969-3886 x107, Fax: 650-969-6422Index:
src/main/org/apache/tools/ant/taskdefs/Cvs.java
>===================================================================
>RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java,v
>retrieving revision 1.14
>diff -u -r1.14 Cvs.java
>--- src/main/org/apache/tools/ant/taskdefs/Cvs.java	2001/04/27 11:52:54	1.14
>+++ src/main/org/apache/tools/ant/taskdefs/Cvs.java	2001/05/31 16:52:21
>@@ -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;
>     }
> }
> 
>
Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message