Not able to read from stdin using gradle api

I am using gradle api 1.7 to connect to a gradle Project that needs user input (interactive). I have tried several ways but nothing worked for me so far. What should I be setting in ‘setStandardInput’ so that gradle api makes the build wait for user input

connection.newBuild()

.forTasks(taskName)

.setStandardInput(System.in)

.run();

When using ‘System.in’ I get the following error

Exception in thread “DisconnectableInputStream source reader” org.gradle.internal.UncheckedException: java.io.EOFException: No input provided for project

at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:39)

at org.gradle.util.DisconnectableInputStream$1.run(DisconnectableInputStream.java:125)

at java.lang.Thread.run(Thread.java:724)

Caused by: java.io.EOFException: No input provided for project

at org.apache.tools.ant.Project.defaultInput(Project.java:1296)

at org.apache.tools.ant.Project.demuxInput(Project.java:1316)

at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:71)

at org.gradle.util.DisconnectableInputStream$1.run(DisconnectableInputStream.java:96)

… 1 more

As far as I know forwarding stdin does not work properly. I have opened an issue here: GRADLE-2462. Your most sensible option is to use arguments like ‘withArguments("-PmyArgument=myValue")’ and request “myValue” yourself.

However, I haven’t checked this issue recently.