I am attempting to do a gradle exec within a loop (see below). The loop occurs (infinitely I might add), but the command does not seem to execute. I’ve run the command itself in command line and it does run successfully. The println’s are there so I can see what is happening. The two println’s within the loop print continually.
How can I make sure the executable actually executes?
//loop until all instances have stopped completely task stopVerify(dependsOn: stopInstances) << {
def diff = matches.size()
println ("diff: " + diff)
while (diff > 0) {
println "difference: " + diff
def stoppedInstances = []
exec {
workingDir ‘/opt/aws/apitools/ec2/bin’
executable “./ec2-describe-instances”
args("–filter",“tag:Level=” + DeployLevel,"–filter",“tag:Type=Application”,"–filter",“instance-state-name=stopped”)
standardOutput = new ByteArrayOutputStream()
def outAsString = standardOutput.toString()
def matchInstanceId = outAsString =~ /INSTANCE\t(i.*)\tami/
matchInstanceId.each {stoppedInstances.add(it[1])}
diff = matches.size() - stoppedInstances.size()
println "Stopped instances: " + stoppedInstances.size()
}
} }
Any Ideas?