pyterm: fix exit behavior if twisted is not available

This commit is contained in:
Hinnerk van Bruinehsen 2014-08-16 00:49:43 +02:00
parent 89a26b7331
commit 1b5836571b

View File

@ -248,8 +248,12 @@ class SerCmd(cmd.Cmd):
# save history file # save history file
readline.write_history_file() readline.write_history_file()
# shut down twisted if running # shut down twisted if running
if reactor.running: try:
reactor.callFromThread(reactor.stop) if reactor.running:
reactor.callFromThread(reactor.stop)
except NameError:
pass
if self.tcp_serial: if self.tcp_serial:
self.ser.close() self.ser.close()
return True return True