mtroost
10 years agoOccasional Contributor
After executing a systemcall , the waitFor() method hangs
This piece of groovy is used in an assertion on a teststep. It does make a systemcall to execute unzip. The cmd itself works fine. the call cmd.execute() works fine and the unzip command is properly executed by the OS.
The problem is the next statement "results.waitFor()" because SoapUI hangs. It doesnt do anything but you cant click on anything except drag the window of the assertion code editor. The canvas however is not painted anymore, all buttons dont work and killing the process is the only way to get rid of it. Commenting out the waitFor line resolves the problem but then you cant test the result of the systemcall.
def unzipPath = "C:\\zip\\unzip.exe" def cmd = "$unzipPath \"$zipFileName\" -d \"${groovyUtils.projectPath}\"" log.info "cmd=$cmd" def results = cmd.execute() results.waitFor() log.info "result is "+results.exitValue() //assert results.exitValue() == 0 //results.destroy()
How can I test the exitValue?