-
Bug
-
Resolution: Unresolved
-
Minor
-
None
When I tried to parse Maven output (which is running using sh -step), noticed that groovy code only sees first line of output. Example pipeline:
node() { def outputLog outputLog = sh(script: "ls -la /", returnStdout: true) println outputLog //prints full log outputLog.eachLine { line, count -> println "$count: $line" } //prints only 1 line outputlog = "ls -la /".execute().text outputlog.eachLine { println it } //prints all lines }
So workaround is to use that Groovy's execute.
Nothing to do with the sh step. Workaround is to avoid the closure idiom and use Java Platform methods to parse.