pyterm: fix exit behavior if twisted is not available
This commit is contained in:
parent
89a26b7331
commit
1b5836571b
8
dist/tools/pyterm/pyterm
vendored
8
dist/tools/pyterm/pyterm
vendored
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user