This question, has an accepted answer that only redirects the out “command” to an output stream. I would like to redirect all the output from a script to a stream, not just a subset of the output that is created with out << "hello world" commands.
This answer changes the script to write all its output via out “command”. Is there a solid solution that does’t require changing the script?
You can bind
System.outto another stream, like (if you’re calling it from plain Java):or more groovier: