Properly fix SIGINT

This commit is contained in:
Alexei Sorokin 2016-08-11 00:31:07 +03:00
parent bf916e83fd
commit b3697b0ba6

View File

@ -3,6 +3,7 @@
import sys import sys
import time import time
import signal
import re import re
import sleekxmpp import sleekxmpp
from irc.bot import SingleServerIRCBot from irc.bot import SingleServerIRCBot
@ -285,7 +286,9 @@ if __name__ == '__main__':
xmpp_opts['muc'] = config.get('XMPP', 'muc') xmpp_opts['muc'] = config.get('XMPP', 'muc')
xmpp_opts['nick'] = config.get('XMPP', 'nick') xmpp_opts['nick'] = config.get('XMPP', 'nick')
try: signal.signal(signal.SIGINT, signal.SIG_DFL)
while True:
inter = Intermedia(shared_opts, irc_opts['chan'], xmpp_opts['muc']) inter = Intermedia(shared_opts, irc_opts['chan'], xmpp_opts['muc'])
ircbot = IRCBot(irc_opts, inter) ircbot = IRCBot(irc_opts, inter)
xmppbot = XMPPBot(xmpp_opts, inter) xmppbot = XMPPBot(xmpp_opts, inter)
@ -303,5 +306,3 @@ if __name__ == '__main__':
irc_thread.join() irc_thread.join()
xmpp_thread.join() xmpp_thread.join()
except (KeyboardInterrupt, SystemExit):
print('Exit')