Skip to content

Instantly share code, notes, and snippets.

@dkandalov
Created May 3, 2013 16:11
Show Gist options
  • Save dkandalov/5510491 to your computer and use it in GitHub Desktop.
Save dkandalov/5510491 to your computer and use it in GitHub Desktop.
Executing command in Groovy (using Ant)
def execute(String command, List<String> parameters) {
def ant = new AntBuilder()
ant.exec(outputproperty:"cmdOut",
errorproperty: "cmdErr",
resultproperty:"cmdExit",
failonerror: "true",
executable: command) {
arg(line: parameters.join(" "))
}
[exitCode: ant.project.properties.cmdExit, stderr: ant.project.properties.cmdErr, stdout: ant.project.properties.cmdOut]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment