ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24918] New: - [PATCH] Permit console input to be sent to <java>
Date Sat, 22 Nov 2003 16:05:05 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24918>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24918

[PATCH] Permit console input to be sent to <java>

           Summary: [PATCH] Permit console input to be sent to <java>
           Product: Ant
           Version: 1.6Beta
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jglick@netbeans.org


Not sure if this has already been discussed and rejected, but anyway here is an
attempt at a patch to let you send console input to <java> - mainly so that you
can use an Ant script to build and then interactively test a console-based Java app.

The patch adds an attribute 'standardinput' to <java>. If true, Ant's stdin will
be passed to the subprocess.

It seems that this *already* happens when fork="false" - not sure if that is
intentional, or if it should be explicitly disabled. Anyway, at least for
fork="true" this patch appears to be necessary to let the subprocess read from
stdin. Otherwise it gets an immediate EOF.

Also adding a few more options to various classes to permit stdin to be read,
and to make the stream pumper autoflush input - if you don't do that, then in
forked mode the data will just build up somewhere and not get sent to the
subprocess.

Tested only on Linux, YMMV on other platforms. Not sure how to go about creating
a unit test for something so inherently platform-specific and difficult to
script (without using Expect or pty's!), but attaching a build file you can test
with manually. Try to run each of the targets individually, and also try running
two or more in sequence to verify that you can Ctrl-D (Unix) to end input to one
task and still go and send some input to the next one.

This patch does not attempt to add the same feature for general <exec>; I am not
sure if it would even be useful to anyone.

Related bug reports I can see:

bug #2738  - Passing of Streams...
bug #3452  - ... add "input" attribute for task "exec"...
bug #24592 - support @input for the exec task

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message