.kill() a process when it times out

This commit is contained in:
jesopo 2018-10-08 23:35:37 +01:00
parent 3016916087
commit fa336d6023

View file

@ -51,8 +51,8 @@ class Module(object):
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
try:
proc.wait(5)
except subprocess.TimeoutExpired:
# execution of script expired
except subprocess.TimeoutExpired as e:
proc.kill()
return
out = proc.stdout.read().decode("utf8").strip("\n")