Conflicts: tests/test.py
@ -68,6 +68,11 @@ def main():
tcp_server.close(next_tick=True)
udp_server.close(next_tick=True)
signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), handler)
def int_handler(signum, _):
sys.exit(1)
signal.signal(signal.SIGINT, int_handler)
loop.run()
except (KeyboardInterrupt, IOError, OSError) as e:
logging.error(e)
@ -77,6 +77,11 @@ def main():
tcp_servers + udp_servers))
signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM),
child_handler)
try:
loop = eventloop.EventLoop()
dns_resolver.add_to_loop(loop)
@ -138,7 +138,9 @@ try:
finally:
for p in [p1, p2]:
os.kill(p.pid, signal.SIGQUIT)
print('kill', file=sys.stderr)
os.kill(p.pid, signal.SIGINT)
print('waitpid', file=sys.stderr)
os.waitpid(p.pid, 0)
except OSError:
pass