ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs ExecTask.java PumpStreamHandler.java
Date Thu, 06 Feb 2003 13:10:21 GMT
conor       2003/02/06 05:10:21

  Modified:    docs/manual/CoreTasks exec.html
               src/main/org/apache/tools/ant/taskdefs ExecTask.java
                        PumpStreamHandler.java
  Log:
  Further development for 7330. Allow errors to be sent to the
  Ant log when redirecting output.
  
  PR:	7330
  
  Revision  Changes    Path
  1.23      +9 -0      jakarta-ant/docs/manual/CoreTasks/exec.html
  
  Index: exec.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/exec.html,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -w -u -r1.22 -r1.23
  --- exec.html	6 Feb 2003 12:53:49 -0000	1.22
  +++ exec.html	6 Feb 2003 13:10:21 -0000	1.23
  @@ -65,6 +65,15 @@
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  +    <td valign="top">logError</td>
  +    <td valign="top">This attribute is used when you wish to see error output in
Ant's
  +                     log and you are redirecting output to a file/property. The error 
  +                     output will not be included in the output file/property. If you 
  +                     redirect error with the &quot;error&quot; or &quot;errorProperty&quot;
  +                     attributes, this will have no effect.</td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
  +  <tr>
       <td valign="top">append</td>
       <td valign="top">whether output and error files should be appended to or overwritten.
       Defaults to false.</td>
  
  
  
  1.47      +20 -3     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  
  Index: ExecTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -w -u -r1.46 -r1.47
  --- ExecTask.java	6 Feb 2003 12:53:49 -0000	1.46
  +++ ExecTask.java	6 Feb 2003 13:10:21 -0000	1.47
  @@ -90,6 +90,8 @@
       private File out;
       private File error;
       
  +    private boolean logError = false;
  +    
       private File dir;
       protected boolean failOnError = false;
       protected boolean newEnvironment = false;
  @@ -174,6 +176,15 @@
       }
   
       /**
  +     * Controls whether error output of exec is logged. This is only useful
  +     * when output is being redirected and error output is desired in the
  +     * Ant log
  +     */
  +    public void setLogError(boolean logError) {
  +        this.logError = logError;
  +    }
  +    
  +    /**
        * File the error stream of the process is redirected to.
        *
        * @since ant 1.6
  @@ -485,7 +496,8 @@
           
               if (outputprop != null) {
                   baos = new ByteArrayOutputStream();
  -                log("Output redirected to ByteArray", Project.MSG_VERBOSE);
  +                log("Output redirected to property: " + outputprop, 
  +                     Project.MSG_VERBOSE);
                   if (out == null) {
                       outputStream = baos;
                   } else {
  @@ -498,11 +510,15 @@
               errorStream = outputStream;
           } 
   
  +        if (logError) {
  +            errorStream = new LogOutputStream(this, Project.MSG_WARN);
  +        }
  +        
           if (error != null)  {
               try {
                   errorStream 
                       = new FileOutputStream(error.getAbsolutePath(), append);
  -                log("Error redirected to " + out, Project.MSG_VERBOSE);
  +                log("Error redirected to " + error, Project.MSG_VERBOSE);
               } catch (FileNotFoundException fne) {
                   throw new BuildException("Cannot write to " + error, fne,
                                            getLocation());
  @@ -514,7 +530,8 @@
       
           if (errorProperty != null) {
               errorBaos = new ByteArrayOutputStream();
  -            log("Error redirected to ByteArray", Project.MSG_VERBOSE);
  +            log("Error redirected to property: " + errorProperty, 
  +                Project.MSG_VERBOSE);
               if (error == null) {
                   errorStream = errorBaos;
               } else {
  
  
  
  1.9       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
  
  Index: PumpStreamHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -w -u -r1.8 -r1.9
  --- PumpStreamHandler.java	6 Feb 2003 12:53:49 -0000	1.8
  +++ PumpStreamHandler.java	6 Feb 2003 13:10:21 -0000	1.9
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  
  
  

Mime
View raw message