>From: "Dick, Brian E." <[EMAIL PROTECTED]> >Sent: Thursday, August 12, 2004 9:17 AM
Short answer: use the 'output="out.file"' attribute of the <exec> task to do redirection (but see below for issues with that). Long answer: >I'm trying to suppress the logging of standard output by redirecting it >to a file. However, the program is choking on the redirection. Is NAnt >doing something funky to the command line arguments? ... > <exec program="m4" > > <arg value="in.file" /> > <arg value=">out.file" /> ... > m4: >out.file: No such file or directory This won't work. It helps to understand how redirection is handled (and this part is essentially the same on both UNIX and MS Windows). Redirection is always done by the shell, or whatever program is invoking the program in question. It does this by creating the open file handles using the indicated redirections for the three standard I/O files (stdin, stdout, stderr), and then creating the subprocess with those items removed from the command line, but set as the defaults for the subprocess. It's never the case that the program being executed gets to see a ">out.file" among its parameters and does the redirection itself. But NAnt (and almost every other thing besides command line shells and Perl) don't do any processing of the explicit arguments. Thus NAnt passes your ">out.file" directly to m4, and m4 doesn't know what to do with it - since it's not responsible for the redirection, the caller - in this case NAnt - is. In theory NAnt could parse the command line arguments, but that's certainly the wrong way for NAnt to work. The right way, which is what it does, is to have explicit attributes for output= , along with the append="true|false" attribute to distinguish between the ">" and ">>" concepts. As for the issues I mentioned in my short answer, current NAnt doesn't really do a redirection, it does a tee. Thus the output will show up in both the indicated output file and in the NAnt file, unless you take other measures to keep it out of the log. Secondly, it only implements stdout redirection, not stderr or stdin. [Aside: adding stderr redirection would make the 'append' attribute ambiguous. It might be better to just have output, outappend, error, and errappend as the attribute names.] Gary ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users
