Exiting control console from gradle script file to file

I want to log all console output from my gradle script to a log file:

gradle test 2>&1 | tee -a gradle.log  

      

But my gradle script is asking the user for a parameter:

task test << {
        System.console().readLine("Enter:").toString()
}

      

As a result, I have a NullPointerException:

Execution failed for task ':test'. Cannot invoke method readLine() on null object

      

Can anyone know a solution or workaround for this situation?

+3


source to share


1 answer


What about:

yes <desired input> | gradle test 2>&1 | tee -a gradle.log 

      



yes

just replicates echo, no matter what the argument is, to stdout

0


source







All Articles