Browse Source

catch KeyError

master
clowwindy 10 years ago
parent
commit
0cd261dd10
  1. 4
      shadowsocks/local.py
  2. 4
      shadowsocks/server.py

4
shadowsocks/local.py

@ -72,12 +72,12 @@ def main():
daemon.set_user(config.get('user', None)) daemon.set_user(config.get('user', None))
loop.run() loop.run()
except (KeyboardInterrupt, IOError, OSError) as e: except Exception as e:
logging.error(e) logging.error(e)
if config['verbose']: if config['verbose']:
import traceback import traceback
traceback.print_exc() traceback.print_exc()
os._exit(1) sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

4
shadowsocks/server.py

@ -87,12 +87,12 @@ def main():
daemon.set_user(config.get('user', None)) daemon.set_user(config.get('user', None))
loop.run() loop.run()
except (KeyboardInterrupt, IOError, OSError) as e: except Exception as e:
logging.error(e) logging.error(e)
if config['verbose']: if config['verbose']:
import traceback import traceback
traceback.print_exc() traceback.print_exc()
os._exit(1) sys.exit(1)
if int(config['workers']) > 1: if int(config['workers']) > 1:
if os.name == 'posix': if os.name == 'posix':

Loading…
Cancel
Save