I used to execute CMDs command inside python using subprocess
, and my partial code is as follows.
import subprocess
proc = subprocess.Popen("mvn test", shell = True)
try:
proc.wait(60) # set timeout of proc
except subprocess.TimeoutExpired:
proc.kill() # kill the proc if it timed out
print("subprocess is killed")
It do will kill the subprocess after proc.kill(), but the side-effect comes, Java(TM) Platform SE binary is still active and take much resource of my computer.So how can I finally kill the Java(TM) Platform SE binary?
I just supposed that command mvn test
will call the JVM(something like that), when I kill the process proc
, the Java(TM) Platform SE binary isn't be killed.
Picture of Windows Resource Manager