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.
Summary: | NB Ant execution does not support console input | ||
---|---|---|---|
Product: | projects | Reporter: | Jesse Glick <jglick> |
Component: | Ant | Assignee: | Jesse Glick <jglick> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | tboudreau |
Priority: | P3 | ||
Version: | 3.x | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 41535 | ||
Attachments: |
Attempted patch which did not seem to do anything - TBD why
Updated patch (untested) Patch in progress More useful test project - helps look at multiple input and output redirections at once (just run it several times) |
Description
Jesse Glick
2003-11-22 15:44:51 UTC
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. |