Hi,

I have a problem executing closures in my pipeline, since they return 
early. I could break down the problem to the following minimal example:

class Foo {
    Closure<String> cl = { String a ->
        return "Say: ${this.bar(a)}"
    }
    String bar(String a) {
        return "Hello ${a}."
    }
}
Foo f = new Foo()
String output = f.getCl()("World")
echo(output)


The expected output of this code is "Say: Hello World.", which it returns 
when I execute it locally in native Groovy. However, in a Jenkins pipeline 
job the code returns "Hello World.".

I assume that the closure directly returns the output of the this.bar(a) 
method call.

After having already reported a ticket 
<https://issues.jenkins-ci.org/browse/JENKINS-43061> for this issue, does 
somebody know more about this issue? Is there a workaround available?


Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/29c78787-d0da-4ae2-8759-e87ec89cf9d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to