You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Conor MacNeill <co...@cortexebusiness.com.au> on 2003/02/08 15:26:51 UTC

New and input capability

I've recently added the capability to redirect input for the exec task. I 
then refactored this into a new class (Redirector) which I then applied to 
the Java task.

For <exec? this means the following new capabilities:

1. you can use an error attribute to redirect stderr independently
of stdout

2. you can use an errorProperty to store the stderr into a property

3. You can store to a file and to a property at the same time.

4. You can use logError="true" to send the error output to the Ant log
when redirecting just stdout.

5. You can take input from a file with the "input" attribute

6. You can task input from a string with "inputstring". This gives
access to Ant properties.

The application of this to <java> task means all these features are
also available to <java> in addition to <exec>'s existing outputProperty 
attribute.

The only limitation at the moment is that you cannot redirect input for a 
non-forked java task - I'm working on that.

If you have any issues with these changes, please let me know. I'll update 
the documenation soon.

Conor


Re: New and input capability

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 10 Feb 2003, Conor MacNeill <co...@cortexebusiness.com.au>
wrote:
>> Does it have any effect on <input>?
> 
> It shouldn't.

A quick test says, it hasn't 8-)

>> Maybe we can use the InputHandler framework here as well?
> 
> Perhaps possible - I didn't really look at doing that. There is a
> bit of a mismatch, though. Inputhandler is prompt driven which
> doesn't really match the separated input and output streams used in
> exec.

Yes.  I remember I played with the more general problem of input
redirection when I worked on the InputHandler stuff but gave in
because I couldn't get things to fit together.

The prompt driven approach is necessary if you want
PropertyFileInputHandler or anything similar to work.

Stefan

Re: New and input capability

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
> 
> Does it have any effect on <input>?
> 

It shouldn't. When input, using the default input handler, reads from 
standard in, that will get routed around the place a bit but eventually 
arrives back at the real standard input stream. The inputstring attribute of 
exec should be able to use any input read in with <input>.


> Maybe we can use the InputHandler framework here as well?  I.e. if
> anybody has an input handler that reads from a JTextArea it could be
> used here?

Perhaps possible - I didn't really look at doing that. There is a bit of a 
mismatch, though. Inputhandler is prompt driven which doesn't really match 
the separated input and output streams used in exec.

> 
> Sorry, I'll really have to look at the code first.
> 

Conor


Re: New and input capability

Posted by Stefan Bodewig <bo...@apache.org>.
On Sun, 09 Feb 2003, Conor MacNeill <co...@cortexebusiness.com.au>
wrote:

> 5. You can take input from a file with the "input" attribute
> 
> 6. You can task input from a string with "inputstring". This gives
> access to Ant properties.
> 
> The application of this to <java> task means all these features are
> also available to <java> in addition to <exec>'s existing
> outputProperty attribute.

Does it have any effect on <input>?

Maybe we can use the InputHandler framework here as well?  I.e. if
anybody has an input handler that reads from a JTextArea it could be
used here?

Sorry, I'll really have to look at the code first.

Stefan

Re: New and input capability

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Conor MacNeill" <co...@cortexebusiness.com.au>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Saturday, February 08, 2003 06:26
Subject: New <exec> and <java> input capability


> I've recently added the capability to redirect input for the exec task. I
> then refactored this into a new class (Redirector) which I then applied to
> the Java task.

hey, this is all very cool; and I like the emerging consistency between java
and exec. Thank you!