views:

925

answers:

1

I'm able to run Groovy scripts from Groovy using

proc = "cmd /c groovy BillingServer.groovy".execute(null, new File("C:\"))

However, I can't find a way to then terminate/kill the process. waitForOrKill(1) and destroy() "act" like they've worked, but the external process continues to run. Calling exitValue() fails with

java.lang.IllegalThreadStateException: process has not exited

How do I kill the process I've started?

+1  A: 

I solved this by removing "cmd /c" from the string to be executed. It seems that cmd was spawning groovy, so waitForOrKill() was killing the cmd process, but the groovy process was left running. Without the "cmd /c", I am spawning a groovy process, and waitForOrKill() successfully kills it.