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] - [PATCH] Permit console input to be sent to <java>
Date Thu, 27 Jan 2005 16:36:45 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.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://issues.apache.org/bugzilla/show_bug.cgi?id=24918


jglick@netbeans.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.7




------- Additional Comments From jglick@netbeans.org  2005-01-27 17:36 -------
I just tested on Win XP and it works fine there too. All tests continue to pass
for me (on JDK 1.4.2 on Linux). Compilation succeeds on JDK 1.2. Functionality
also seems to work as expected embedded inside the NetBeans IDE.

I am committing this to the Ant trunk (for 1.7) under the "lazy approval"
theory. I think it would be a good candidate for a fix in 1.6.3, since this
introduces no internal API or build script format changes and to my mind fixes a
bug, but I will leave it to other committers to comment on that. Note that I am
on vacation for the whole month of February, but if someone else would like to
merge this to ANT_16_BRANCH that would be great.

So a quick summary of what the problem was and what is now fixed:

--------
In Ant 1.6.2 (for example), if you had a program which tried to read from
standard input, and ran it with <java fork="false">, it would work fine. However
if you ran it with <java fork="true">, it would not - it would get an immediate
EOF. As far as I can tell, this is just because no one bothered to make it work,
not that there is any particular benefit to disabling input for forked apps. In
any case, as Conor mentions, passing the -noinput flag would cause even unforked
apps to get an immediate EOF.

With the patch, you can send console input to programs run with <java>, whether
forked or not. (Not to spawned programs however.) -noinput still works in either
case to suppress input.
--------

You can use the "better Ant script..." to try it out. You can also confirm that
it is possible to run more than one app taking stdin in the same Ant session;
sending EOF (Ctrl-D on Unix, Ctrl-Z ENTER on Windows) stops input to the running
app but does not prevent a subsequent app from accepting input normally.

Unlike the original patch, the revised patch does *not* introduce a special
attribute to the <java> task. I don't think one is required; it should be
expected that forked and unforked apps work the same way unless there is a
reason for them to differ, and that an app requesting input will get it unless
you have a reason to suppress input.

The current patch makes no API changes, since all code changes are in the same
package and it is not necessary, but there are several places where an API
addition would be natural; in those cases I have commented out "public" or
"protected" but left it in the code so you can see what the API would be. Will
leave it to other committers to comment on whether some or all of these API
additions are desirable.

Checking in WHATSNEW;
/home/cvs/ant/WHATSNEW,v  <--  WHATSNEW
new revision: 1.731; previous revision: 1.730
done
More commits to come...
Checking in docs/manual/CoreTasks/java.html;
/home/cvs/ant/docs/manual/CoreTasks/java.html,v  <--  java.html
new revision: 1.36; previous revision: 1.35
done
More commits to come...
Checking in src/main/org/apache/tools/ant/taskdefs/Java.java;
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v  <--  Java.java
new revision: 1.97; previous revision: 1.96
done
Checking in src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java;
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java,v 
<--  PumpStreamHandler.java
new revision: 1.21; previous revision: 1.20
done
Checking in src/main/org/apache/tools/ant/taskdefs/Redirector.java;
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Redirector.java,v  <-- 
Redirector.java
new revision: 1.24; previous revision: 1.23
done
Checking in src/main/org/apache/tools/ant/taskdefs/StreamPumper.java;
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java,v  <-- 
StreamPumper.java
new revision: 1.21; previous revision: 1.20
done


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

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


Mime
View raw message