System.console().readLine(..) is broken since Gradle 2.13

issue-acknowledged
gradle-3446

(Fernando Rubbo) #1

Gradle Version: 2.13 +
Operating System: Linux
Is this a regression? 2.12

Output whenever executing System.console().readLine(’\nType “y” to accept: ') on Gradle 2.12

fernando@fernote:./gradlew testConsole
[task ':testConsole']
:testConsole
Testing Gradle Version 2.12
> Building 0% > :testConsole
Type "y" to accept:

Now, executing System.console().readLine(’\nType “y” to accept: ') on Gradle 2.13 onwards

fernando@fernote:./gradlew testConsole
> Configuring > 1/1 projects
[task ':testConsole']
:testConsole
Testing Gradle Version 2.13
> Building 0% > :testConsole

Note that the message ‘Type “y” to accept:’ is not shown in Gradle 2.13 onwards.

Gradle testConsole task:

task ('testConsole') << {
	group = "help"
	println 'Testing Gradle Version ' + GradleVersion.current().getVersion()

	def ok = System.console().readLine('\nType "y" to accept: ')
	if("y".equalsIgnoreCase(ok) ) {
		println "=== WoHoo!! You are a super star! ==="
	} else {
		println "=== Sorry.. You have canceled! ==="
	}
}

(Stefan Wolf) #2

Thank you for your bug report!

Is this the same issue as reported in Console.readline() does not print text if run from doLast with gradle 2.13 ?


(Fernando Rubbo) #3

Looks like so… But if you look at our example, the below code also do not
work.

task run { console.readLine('> What is your first name?: ') }

(Fernando Rubbo) #4

Do exist any ETA for fixing that?