dang!
gius_,
here's another-other option. exec cmd.exe and use DOS redirection.
for example, here's a target that works for me:
<target name="test2" description="testing exec task output params" >
<property name="myoutfile" value="c:\temp.txt" />
<exec failonerror="false" program="cmd.exe" commandline="/c
cleanxml.exe -help > "${myoutfile}"" />
<echo message="made it through" />
</target>
notes:
1) <exec> returns a failure code. maybe if i played w/ the switches
longer i can lose that, but saying failonerror="false" makes it work so
it's good enough for now.
2) remember to use & stuff in the commandline text
3) i found i had to put quotes around the filename
4) remember to prefix the line w/ the "/c" switch
so, in case it's not clear above, what this does is run my
"cleanxml.exe" program w/ its option "-help" and pipe the output to an
ad hoc file "c:\temp.txt". to prove it made it through, echo a message.
i can then open c:\temp.txt and see all output neatly (line breaks
included), whereas using <exec output...> wasn't neat at all.
i hope this works for you.
-jean
> -----Original Message-----
> From: Giuseppe Greco [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 29, 2003 13:10
> To: [EMAIL PROTECTED]
> Cc: 'NAnt Users'; [EMAIL PROTECTED]
> Subject: RE: [Nant-users] Problem with the <exec> task
>
>
> Jean,
>
> unfortunately <exec append="true" ../> doesn't work for me...
> I use the <exec> task to produce a FO file with xsltproc,
> and then I process the resulting FO file with a FO processor.
> It seems that the FO processor doesn't accept xml files
> without breaks between lines...
>
> So, I think I have to wait until your patch is committed.
>
> Bye,
>
> Gius_.
>
>
> On Thu, 2003-05-29 at 17:44, Jean Rajotte wrote:
> > 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
> > >
> --
> ----------------------------------------
> 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-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers