Browse Source

use SIGINT instead in tests

Conflicts:
	tests/test.py
auth
clowwindy 10 years ago
parent
commit
536b7d1ee6
  1. 5
      shadowsocks/local.py
  2. 5
      shadowsocks/server.py
  3. 4
      tests/test.py

5
shadowsocks/local.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)

5
shadowsocks/server.py

@ -77,6 +77,11 @@ def main():
tcp_servers + udp_servers))
signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM),
child_handler)
def int_handler(signum, _):
sys.exit(1)
signal.signal(signal.SIGINT, int_handler)
try:
loop = eventloop.EventLoop()
dns_resolver.add_to_loop(loop)

4
tests/test.py

@ -138,7 +138,9 @@ try:
finally:
for p in [p1, p2]:
try:
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

Loading…
Cancel
Save