stevel      2005/02/08 10:51:26

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional Rpm.java
  Log:
  return code checking on rpm. How do we test this?
  
  Revision  Changes    Path
  1.23      +9 -15     
ant/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
  
  Index: Rpm.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Rpm.java  9 Mar 2004 16:48:15 -0000       1.22
  +++ Rpm.java  8 Feb 2005 18:51:26 -0000       1.23
  @@ -27,6 +27,7 @@
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
  +import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.ant.taskdefs.Execute;
   import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
   import org.apache.tools.ant.taskdefs.LogOutputStream;
  @@ -161,25 +162,18 @@
   
           exe.setCommandline(toExecute.getCommandline());
           try {
  -            exe.execute();
               log("Building the RPM based on the " + specFile + " file");
  +            int returncode = exe.execute();
  +            if (returncode != 0) {
  +                throw new BuildException("'" +
  +                        toExecute.getExecutable() +
  +                        "' failed with exit code "+returncode);
  +            }
           } catch (IOException e) {
               throw new BuildException(e, getLocation());
           } finally {
  -            if (output != null) {
  -                try {
  -                    outputstream.close();
  -                } catch (IOException e) {
  -                    // ignore any secondary error
  -                }
  -            }
  -            if (error != null) {
  -                try {
  -                    errorstream.close();
  -                } catch (IOException e) {
  -                    // ignore any secondary error
  -                }
  -            }
  +            FileUtils.close(outputstream);
  +            FileUtils.close(errorstream);
           }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to