Realtime output to console from string execute

I want to run a string command “…” and see the output on the console as it is running. Now I do cmd.execute().waitFor() but the console shows no progress. What is the best way to do this?

project.exec { commandLine = [ 'echo', 'hello!' ] }

If your command is a string and you can’t control that, you’ll need to split it into a List.

Alternatively, you can use the task type Exec.

thank you both i did a combo of this actually i put the commandLine = [ x, y, z ] into an Exec task