I don't know if this is a Win32 thing, because the following works for me:

Buildfile build-perl.xml:

<project name="mytest" default="run_perl" basedir="."> <target name="run_perl" description="Test STDOUT"> <exec executable="perl" dir="${basedir}"> <arg value="foo.pl"/> <arg value="-h yes"/> </exec> </target> </project>

Script: foo.pl

#!/usr/bin/perl use strict; use Getopt::Std; my %opts = (); getopt( 'h', \%opts ); if ( $opts{h} ) { print "Printing help..."; } else { print "No help requested, none given."; }

Running it gives me:

[wintercm@juvenile test]$ ant -buildfile build-perl.xml Buildfile: build-perl.xml run_perl: [exec] Printing help... BUILD SUCCESSFUL Total time: 2 seconds

And if I comment out the second argument from the exec task, I get:

[wintercm@juvenile test]$ ant -buildfile build-perl.xml Buildfile: build-perl.xml run_perl: [exec] No help requested, none given. BUILD SUCCESSFUL Total time: 2 seconds

...which is exactly what I'd expect. Try running this on your machine to see what happens. If it doesn't work, look into the docs to see if Ant on Win32 does anything funky with STDOUT.

Chris
M-x auto-bs-mode


In reply to Re: Ant, Perl, and where did my STDOUT go? by lachoy
in thread Ant, Perl, and where did my STDOUT go? by P0w3rK!d

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.