Groovy shell.evaluate output

377 Views Asked by At

I am new to groovy and I want to check the output of shell.evaluate(something) and see what it returns. First, what exactly does shell.evaluate do and what does it return? More specifically, I want to make sure that this is not null. How do I do this?

1

There are 1 best solutions below

0
On

What it does, is it executes the Groovy program that you stored as String in something. It will then return the result of this program. If there is no result (void method for example), then the result will be null. There is no way to reliably check that something will not return null before you evaluate it. You can of course look at the result.