I want to convert my special-purpose Bash unit testing script to Groovy, and I want to use Gradle’s excellent wrapper system to eliminate the need for users to install Groovy. I can do everything I want, except that when I invoke Groovy from my Gradle build script, Gradle writes an extra space character after each backspace character that I write. This works perfectly when invoked directly with Groovy:
class Hg {
public static doit() {
println ‘Doing it’
for (i in 1…10) {
print ‘-’
System.out.flush()
Thread.sleep(1000)
print ‘\b+’
System.out.flush()
Thread.sleep(1000)
}
println()
} }
Hg.doit()</code.
If you can’t tell by the code, it prints a line of hypens, and as each test succeeds, it backspaces and changes the - to a +, so that when it’s finished the screen shows: ++++++++++
I have tried the following things, and none have any effect: * use System.out directly instead of prints * use Gradle’s --no-color switch * write the \b separately, with flush after it * coerce the \b to a character (in case something’s converting it into a String