.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) stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
try: try:
proc.wait(5) proc.wait(5)
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired as e:
# execution of script expired proc.kill()
return return
out = proc.stdout.read().decode("utf8").strip("\n") out = proc.stdout.read().decode("utf8").strip("\n")