ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Hendrie" <john.hend...@gmail.com>
Subject Re: Getting Ant to print the arguments of System.out.print() calls
Date Tue, 08 Jan 2008 15:16:30 GMT
Hi,

Thanks for the explanation. What I'm trying to do is have an embedded python
console (using Jython). I'm printing a python prompt (>>>) using
System.out.print() then waiting for user input. Is there any other way I
could do this using Ant (without having to go into the internals of Ant)?

Thanks!
Robert

On Jan 8, 2008 2:44 PM, <Jan.Materne@rzf.fin-nrw.de> wrote:

> > On Jan 8, 2008 5:54 AM, John Hendrie <john.hendrie@gmail.com> wrote:
> > > public class Main {
> > >     public static void main(String[] args) {
> > >         System.out.print("Hello"); [...]
> > >     }
> > > }
> > >
> > > Ant doesn't output "Hello", I have to exit the Java app for
> > it to appear.
> > > Any ideas on how I can solve this?
> >
> > In Ant, the default System.out stream is replaced by an Ant-controlled
> > stream to be able to capture output from all code run within Ant, and
> > prefix the task name for example. Conor as a good write up on this
> > somewhere, but basically Ant's logging system buffers all output by
> > line, and since you use print instead of println, there's no carriage
> > return that would flush Ant's buffer. The flush on System.out in your
> > code has no effect. You can test this by issuing a println instead.
> >
> > I don't think there's a way around this without some tricky coding,
> > although it could also be that no one thought this was worth the dev
> > effort and possible struggle to get it accepted to "un-line-buffer"
> > the logging sub-system... --DD
>
>
> Good catch, Dominique.
>
>
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message