Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.5.6
-
None
-
Windows XP, Eclipse 3.4.2 , Ant 1.6.5
Description
I have a groovy program that I am running from Ant in Eclipse
using <groovy src="thepgm.groovy" />
I can write to the console using println
But I can't read from the console.
When I try to, the program waits at the right place
and I can type in the console window
but I can't terminate the input and return to the program.
I have tried ctrl+c, ctrl+z, and esc
(When I ran a groovy program directly in Eclipse, I had to terminate with ctrl+z)
I have to cancel the program.
I would like a way that work in environment, and also if I run it from an Ant job in the command window
I have tried the following, with and w/o the import statements.
<target name="groovy.test.console.in" description=""> <!-- ***** Not working ***** --> <groovy> //import console.* //import java.io.* println "Hello World" //Process1 () //Process2 () //Process3 () Process4 () return def Process1 () { ans = System.in.readLines() //ans = System.in.readLine() println "ans = " + ans } def Process2 () { def stdin = new BufferedReader(new InputStreamReader(System.in)) print "Enter info: " String info = stdin.readLine() print "You entered: " + info } def Process3 () { println "Starting Process3" ant.echo("Ant says Hello World") ant.input(message:"Enter a name",addproperty:"a.name") } def Process4 () { println "Starting Process4" System.in.readLines().each { println it } } </groovy> </target>