-
Bug
-
Resolution: Duplicate
-
Minor
-
None
I'm not entirely sure what is happening but it appears that when these methods are called it only runs the closure once and doesn't return the expected values.
def test() { l = ['a', 'b', 'c'] r = [] for (String v : l) { r.add(v) } println r.join(' ') r = l.collect { it } println r.join(' ') } test()
If I run the above with command-line groovy it does what is expected:
$ groovy test.groovy a b c a b c
If I put this in the vars/ directory of a global pipeline library and call is as "test.test()" only the first loop works:
[Pipeline] echo a b c [Pipeline] echo [Pipeline] End of Pipeline Finished: SUCCESS
- duplicates
-
JENKINS-26481 Mishandling of binary methods accepting Closure
- Resolved