This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I.e. even when Ant as run from the command line would permit console input to be passed through to a task, Ant run from NB using the Output Window never passes any input. You can type stuff in the Output Window but it is apparently not sent to Ant. Only really relevant for Ant 1.6 which improves console input handling. See also: http://issues.apache.org/bugzilla/show_bug.cgi?id=2738 http://issues.apache.org/bugzilla/show_bug.cgi?id=3452 http://issues.apache.org/bugzilla/show_bug.cgi?id=24592
Created attachment 12267 [details] Attempted patch which did not seem to do anything - TBD why
I also filed: http://issues.apache.org/bugzilla/show_bug.cgi?id=24918 which I was testing this patch with.
May be a priority esp. for programming students who tend to use stdin a lot.
Created attachment 14771 [details] Updated patch (untested)
Besides patching the Ant module, I am patching core/output (which seems to forget to flush its PipedWriter - may or may not matter, I'm not sure) and o.o.util.io.ReaderInputStream, which did not correctly implement 3-arg read(...). Now works with this main app (JDK 1.5): import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = Scanner.create(System.in); while (true) { int i = sc.nextInt(); if (i == 0) { break; } System.out.println("Square of " + i + " is " + (i * i)); } } } But you need to run w/ internal exec for now, due to Ant #24918, which I hope to get fixed for Ant 1.6.2. To test w/ internal exec, add to build.xml: <target name="init-macrodef-java"> <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> <attribute name="classname" default="${main.class}"/> <element name="customize" optional="true"/> <sequential> <java classname="@{classname}" fork="false"> <classpath> <path path="${run.classpath}"/> </classpath> <customize/> </java> </sequential> </macrodef> </target>
committed Up-To-Date 1.8 openide/src/org/openide/util/io/ReaderInputStream.java committed Up-To-Date 1.28 core/output/src/org/netbeans/core/output/OutputTabInner.java committed * Up-To-Date 1.13 ant/src-bridge/org/apache/tools/ant/module/bridge/impl/BridgeImpl.java committed * Up-To-Date 1.13 ant/src/org/apache/tools/ant/module/bridge/AntBridge.java committed * Up-To-Date 1.4 ant/src/org/apache/tools/ant/module/bridge/BridgeInterface.java committed * Up-To-Date 1.4 ant/src/org/apache/tools/ant/module/bridge/DummyBridgeImpl.java committed * Up-To-Date 1.39 ant/src/org/apache/tools/ant/module/run/TargetExecutor.java
Still some problems w.r.t. handling input from >1 process at a time, etc. Have an apparently working fix in progress.
Created attachment 15076 [details] Patch in progress
Created attachment 15077 [details] More useful test project - helps look at multiple input and output redirections at once (just run it several times)
Fixing multiple process problem: committed Up-To-Date 1.15 ant/src/org/apache/tools/ant/module/bridge/AntBridge.java
Verified.