jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-2362

Can't have two inputs after each other

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.1-rc-3
  • Fix Version/s: 1.5
  • Component/s: groovy-jdk
  • Labels:
    None

Description

The following Gant script fails with the message:

Enter HTTP proxy host [localhost]: [localhost]

Enter HTTP proxy port [80]: [80]
Failed to read input from Console.

import org.codehaus.groovy.grails.commons.GrailsClassUtils as GCU

grailsHome = Ant.project.properties."environment.GRAILS_HOME"

includeTargets << new File ( "${grailsHome}/scripts/Init.groovy" )  

target('default': "The description of the script goes here!") {
    doStuff()
}

target(doStuff: "The implementation task") {
	    def proxyHost = System.getProperty("http.proxyHost") ? System.getProperty("http.proxyHost") : 'localhost'
	        def proxyPort = System.getProperty("http.proxyPort") ? System.getProperty("http.proxyPort") : '80'
	        def proxyUser = System.getProperty("http.proxyUserName") ? System.getProperty("http.proxyUserName") : ''
	        def proxyPassword = System.getProperty("http.proxyPassword") ? System.getProperty("http.proxyPassword") : ''


	        Ant.input(addProperty:"proxy.host", message:"Enter HTTP proxy host [${proxyHost}]: ",defaultvalue:proxyHost)
	       Ant.input(addProperty:"proxy.port", message:"Enter HTTP proxy port [${proxyPort}]: ",defaultvalue:proxyPort)
	     Ant.input(addProperty:"proxy.user", message:"Enter HTTP proxy username [${proxyUser}]: ",defaultvalue:proxyUser)
	       Ant.input(addProperty:"proxy.password", message:"Enter HTTP proxy password [${proxyPassword}]: ",defaultvalue:proxyPassword)
}

Issue Links

is depended upon by

Bug - A problem which impairs or prevents the functions of the product. GRAILS-1979 "grails set-proxy" in 1.0 RC2 terminates prematurely

  • Major - Major loss of function.
  • Resolved - A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Graeme Rocher added a comment - 06/Dec/07 9:31 AM

Thought it was a Gant problem but the following AntBuilder script exhibits the same problem:

ant = new AntBuilder()
ant.input(addproperty:"foo", message:"bar")
ant.input(addproperty:"bar", message:"foo")

Caught: : Failed to read input from Console.
at test.run(test.groovy:3)
at test.main(test.groovy)

Show
Graeme Rocher added a comment - 06/Dec/07 9:31 AM Thought it was a Gant problem but the following AntBuilder script exhibits the same problem:
ant = new AntBuilder()
ant.input(addproperty:"foo", message:"bar")
ant.input(addproperty:"bar", message:"foo")
Caught: : Failed to read input from Console. at test.run(test.groovy:3) at test.main(test.groovy)
Hide
Permalink
Graeme Rocher added a comment - 06/Dec/07 9:33 AM

This issue for Grails depends on this: http://jira.codehaus.org/browse/GRAILS-1979

Show
Graeme Rocher added a comment - 06/Dec/07 9:33 AM This issue for Grails depends on this: http://jira.codehaus.org/browse/GRAILS-1979
Hide
Permalink
Marc Guillemot added a comment - 07/Dec/07 4:22 AM

It seems that this is due to changes in Ant 1.7 as it works in Ant 1.6.5.

I've found that some (everything?) of the stuff done in org.apache.tools.ant.Main#runBuild needs to be done by the AntBuilder too. In the case of the input stream problem this is:

p.setDefaultInputStream(System.in);
p.setInputHandler(new DefaultInputHandler());
System.setIn(new DemuxInputStream(p));

I haven't time to integrate it in the AntBuilder neither to test it extensively now. ;-(

In the case of the AntBuilder, it would be probably best to set the System.in each time before executing a task and to reset it when the task is executed, otherwise it could cause interferences with user's usage of System.in.

Show
Marc Guillemot added a comment - 07/Dec/07 4:22 AM It seems that this is due to changes in Ant 1.7 as it works in Ant 1.6.5. I've found that some (everything?) of the stuff done in org.apache.tools.ant.Main#runBuild needs to be done by the AntBuilder too. In the case of the input stream problem this is: p.setDefaultInputStream(System.in); p.setInputHandler(new DefaultInputHandler()); System.setIn(new DemuxInputStream(p)); I haven't time to integrate it in the AntBuilder neither to test it extensively now. ;-( In the case of the AntBuilder, it would be probably best to set the System.in each time before executing a task and to reset it when the task is executed, otherwise it could cause interferences with user's usage of System.in.
Hide
Permalink
Chris Wash added a comment - 24/Sep/10 11:25 AM

I am still seeing this behavior, running a build from Gradle.

$> gradle -v

------------------------------------------------------------
Gradle 0.8
------------------------------------------------------------

Gradle buildtime: Monday, September 28, 2009 2:01:59 PM CEST
Groovy: 1.6.4
Ant: Apache Ant version 1.7.0 compiled on December 13 2006
Ivy: 2.1.0-rc2
Java: 1.6.0_20
JVM: 16.3-b01-279
JVM Vendor: Apple Inc.
OS Name: Mac OS X

build_common.xml:87: Failed to read input from Console.
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:541)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:140)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:96)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:367)
... 24 common frames omitted
Caused by: org.apache.tools.ant.BuildException: Failed to read input from Console.
at org.apache.tools.ant.input.DefaultInputHandler.handleInput(DefaultInputHandler.java:59)
at org.apache.tools.ant.taskdefs.Input.execute(Input.java:231)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
... 38 common frames omitted
Caused by: java.io.IOException: Stream closed
at org.apache.tools.ant.input.DefaultInputHandler.handleInput(DefaultInputHandler.java:56)
... 55 common frames omitted

BUILD FAILED

Show
Chris Wash added a comment - 24/Sep/10 11:25 AM I am still seeing this behavior, running a build from Gradle. $> gradle -v ------------------------------------------------------------ Gradle 0.8 ------------------------------------------------------------ Gradle buildtime: Monday, September 28, 2009 2:01:59 PM CEST Groovy: 1.6.4 Ant: Apache Ant version 1.7.0 compiled on December 13 2006 Ivy: 2.1.0-rc2 Java: 1.6.0_20 JVM: 16.3-b01-279 JVM Vendor: Apple Inc. OS Name: Mac OS X build_common.xml:87: Failed to read input from Console. at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:541) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62) at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:140) at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:96) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:367) ... 24 common frames omitted Caused by: org.apache.tools.ant.BuildException: Failed to read input from Console. at org.apache.tools.ant.input.DefaultInputHandler.handleInput(DefaultInputHandler.java:59) at org.apache.tools.ant.taskdefs.Input.execute(Input.java:231) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62) at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) at org.apache.tools.ant.Project.executeTargets(Project.java:1181) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416) ... 38 common frames omitted Caused by: java.io.IOException: Stream closed at org.apache.tools.ant.input.DefaultInputHandler.handleInput(DefaultInputHandler.java:56) ... 55 common frames omitted BUILD FAILED

People

  • Assignee:
    Guillaume Laforge
    Reporter:
    Graeme Rocher
Vote (0)
Watch (1)

Dates

  • Created:
    06/Dec/07 9:28 AM
    Updated:
    24/Sep/10 11:25 AM
    Resolved:
    07/Dec/07 2:50 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.