def signal_handler(signal, frame):
print("Caught signal {}".format(SIGNALS_TO_NAMES_DICT[signal]))
def signal_handler(signal, frame):
print("Caught signal {}".format(SIGNALS_TO_NAMES_DICT[signal]))
try:
proc = subprocess.Popen(args, bufsize=1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, preexec_fn=os.setsid)
try:
proc = subprocess.Popen(args, bufsize=1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, preexec_fn=os.setsid)
- pgtokill = os.getpgid(proc.pid)
+ try:
+ pgtokill = os.getpgid(proc.pid)
+ except: # Ugly and psychorigid. Please improve python doc so we know what exceptions getpgid can throw.
+ # os.getpgid failed. OK, no cleanup.
+ pass
except FileNotFoundError:
print("["+FileReader().filename+":"+str(self.linenumber)+"] Cannot start '"+args[0]+"': File not found")
tesh_exit(3)
except FileNotFoundError:
print("["+FileReader().filename+":"+str(self.linenumber)+"] Cannot start '"+args[0]+"': File not found")
tesh_exit(3)
cmdName = FileReader().filename+":"+str(self.linenumber)
try:
(stdout_data, stderr_data) = proc.communicate("\n".join(self.input_pipe), self.timeout)
cmdName = FileReader().filename+":"+str(self.linenumber)
try:
(stdout_data, stderr_data) = proc.communicate("\n".join(self.input_pipe), self.timeout)
except subprocess.TimeoutExpired:
print("Test suite `"+FileReader().filename+"': NOK (<"+cmdName+"> timeout after "+str(self.timeout)+" sec)")
kill_process_group(pgtokill)
except subprocess.TimeoutExpired:
print("Test suite `"+FileReader().filename+"': NOK (<"+cmdName+"> timeout after "+str(self.timeout)+" sec)")
kill_process_group(pgtokill)