Bug 50960 - read on System.in hangs for forked java task
Summary: read on System.in hangs for forked java task
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.8.2
Hardware: Macintosh All
: P2 regression (vote)
Target Milestone: 1.8.3
Assignee: Ant Notifications List
URL:
Keywords:
: 50529 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-23 17:30 UTC by Ron Goldman
Modified: 2012-01-19 15:02 UTC (History)
1 user (show)



Attachments
build file to demonstrate the problem (1.73 KB, text/plain)
2011-03-23 17:31 UTC, Ron Goldman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Goldman 2011-03-23 17:30:04 UTC
I just started using Ant 1.8.2 as it was installed along with the latest Java Update for the Mac (JavaForMacOSX10.6Update4). Projects that worked fine with Ant 1.8.1 no longer work in 1.8.2. The problem seems to be that a Java task that forks a jvm hangs when it tries to read from System.in. Has anyone else seen this problem? 

Attached is a simple build.xml file that demonstrates the problem. It creates a simple Java file that just calls readLine() and echos the input, compiles the file, and runs it twice: once in a non-forked JVM, which works fine, and again in a forked JVM, which hangs.

-- Ron --

Here is a sample output:

> ant 
Buildfile: /Users/Ron/Development/Spots/tmp/ant-test/build.xml 

compile: 
   [echo]  
   [echo] ant.version      = Apache Ant(TM) version 1.8.2 compiled on December 20 2010 
   [echo] ant.home         = /usr/share/ant 
   [echo] ant.library.dir  = /usr/share/ant/lib 
   [echo] ant.java.version = 1.6 
   [echo]    
  [javac] Compiling 1 source file to /Users/Ron/Development/Spots/tmp/ant-test 

good: 
   [echo] This will work: calling Java with fork=false 
   [java]  
   [java] Please enter some text and hit return: 
asdf 
   [java] Text entered = asdf 

bad: 
   [echo] This will hang: calling Java with fork=true 
   [java]  
   [java] Please enter some text and hit return: 
asdf 
ddfd 
C-c C-c

---------------------------------------

On Mar 23, 2011, at 1:57 PM, Nicolas Lalevée wrote:

I can reproduce it locally. Could you please fill a bugzilla bug report [1], I'll look deeper into it.

Nicolas
Comment 1 Ron Goldman 2011-03-23 17:31:27 UTC
Created attachment 26795 [details]
build file to demonstrate the problem
Comment 2 Nicolas Lalevée 2011-03-29 17:02:00 UTC
Some stream was not flushed. Now fixed in trunk. Thanks for the report.
Comment 3 Antoine Levy-Lambert 2011-04-21 12:28:16 UTC
The edit done to fix this was svn 1086741
Comment 4 Antoine Levy-Lambert 2011-04-21 12:30:11 UTC
Link in viewvc is http://svn.apache.org/viewvc?view=revision&revision=1086741
Comment 5 Jesse Glick 2012-01-19 15:02:47 UTC
*** Bug 50529 has been marked as a duplicate of this bug. ***