Calling shell commands in groovy script, used in Jenkins pipeline
问题 I have a Jenkins pipeline script in that I load an external Groovy script that contains some functions to perform my build. These functions should be plain groovy because I also want to use them outside of Jenkins, if someone runs a build on a local computer somewhere. In these functions I need to execute shell commands and evaluate the result. This works fine in groovy calling a function like def SomeFunction() { def result = "Some shell command".execute().text } However, this method of