indeed there is a problem (i see it in the code).

Gius,
if you do <exec append="true" ... />, you'll get all the text output,
but no line breaks between each output lines.  hopefully, that helps
some for now...

nant-dev, 
i don't have write-access to cvs, so i'm submitting a patch here, which
i haven't tested but that's straightforward, me thinks.

the problem is in ExternalProgramBase.cs

here the code snippet that misbehaves, followed by the code that SHOULD
work.

before:
        private void StreamReaderThread_Error() {
            StreamReader reader = ( StreamReader )_htThreadStream[
Thread.CurrentThread.Name ];
            while ( true ) {                        
                string strLogContents = reader.ReadLine();
                if ( strLogContents == null )
                    break;
                // Ensure only one thread writes to the log at any time
                lock ( _htThreadStream ) {
                    
                    logger.Error(strLogContents);
                    //do not print LogPrefix, just pad that length...
                    Log.WriteLine(new string(char.Parse(" "),
LogPrefix.Length) + strLogContents);

                    if (OutputFile != null && OutputFile != "") {
                        StreamWriter writer = new
StreamWriter(OutputFile, OutputAppend);
                        writer.Write(strLogContents);
                        writer.Close();
                    }
                }
            }
        }
after:
#1: use writer.WriteLine(...)
#2: use doAppend, not OutputAppend.  doAppend initially set to
OutputAppend, then always true.

        private void StreamReaderThread_Output() {
            StreamReader reader = (StreamReader)
_htThreadStream[Thread.CurrentThread.Name];
            bool doAppend = OutputAppend;
            while (true) {
                string strLogContents = reader.ReadLine();
                if (strLogContents == null)
                    break;
                // Ensure only one thread writes to the log at any time
                lock (_htThreadStream) {
                    logger.Info(strLogContents);
                    //do not print LogPrefix, just pad that length.
                    Log(Level.Info, new string(char.Parse(" "),
LogPrefix.Length) + strLogContents);

                    if (OutputFile != null && OutputFile.Length != 0) {
                        StreamWriter writer = new
StreamWriter(OutputFile, doAppend);
                        writer.WriteLine(strLogContents);
                        doAppend = true;
                        writer.Close();
                    }
                }
            }
        }





> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Giuseppe Greco
> Sent: Thursday, May 29, 2003 09:04
> To: NAnt Users
> Subject: [Nant-users] Problem with the <exec> task
> 
> 
> Hi all,
> 
> There is a problem with the <exec> task. To produce a 
> Formattings Object (FO) file, I've written a task like
> this:
> 
> <exec program="xsltproc" output="${build.dir}/mydocument.fo"
>   commandline="mystylesheet.xsl mydocument.xml"/>
> 
> If you give a look at the generated mydocument.fo file,
> only the first output line generated by xsltproc is there... 
> the rest is lost.
> 
> This is just an example; I stated the same problem with
> other programs when trying to redirect output with the
> 'output' property.
> 
> Gius_.
> 
> ----------------------------------------
> Giuseppe Greco
> 
> ::agamura::
> 
> phone:  +41 (0)91 604 67 65
> mobile: +41 (0)76 390 60 32
> email:  [EMAIL PROTECTED]
> web:    www.agamura.com
> ----------------------------------------
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: eBay
> Get office equipment for less on eBay! 
> http://adfarm.mediaplex.com/ad/ck/711-11697-> 6916-5
> 
> _______________________________________________
> 
> Nant-users mailing list
> [EMAIL PROTECTED] 
> https://lists.sourceforge.net/lists/listinfo/n> ant-users
> 

Attachment: ExternalProgramBase.patch
Description: Binary data

Reply via email to