Enter the following pipe
stage "NOK" "A.AA\nB.BB\n".splitEachLine(/\./) { line -> println "${line[0]} -> ${line[1]}" } stage "OK" "A.AA\nB.BB\n".split(/\n/).each { line = it.split(/\./) println "${line[0]} -> ${line[1]}" }
and disable the sandbox. When you run the pipeline you will see
[Pipeline] stage (NOK) Entering stage NOK Proceeding [Pipeline] echo A -> AA [Pipeline] stage (OK) Entering stage OK Proceeding [Pipeline] echo A -> AA [Pipeline] echo B -> BB [Pipeline] End of Pipeline Finished: SUCCESS
You see that the splitEachLine() is only processing the first line (NOK-stage). I would expect the same result as in the OK-stage.
- duplicates
-
JENKINS-26481 Mishandling of binary methods accepting Closure
- Resolved