From 1b5836571b63bdcee8ff33233373e86e587f185f Mon Sep 17 00:00:00 2001 From: Hinnerk van Bruinehsen Date: Sat, 16 Aug 2014 00:49:43 +0200 Subject: [PATCH] pyterm: fix exit behavior if twisted is not available --- dist/tools/pyterm/pyterm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/tools/pyterm/pyterm b/dist/tools/pyterm/pyterm index fd07195ed..d159d12c9 100755 --- a/dist/tools/pyterm/pyterm +++ b/dist/tools/pyterm/pyterm @@ -248,8 +248,12 @@ class SerCmd(cmd.Cmd): # save history file readline.write_history_file() # shut down twisted if running - if reactor.running: - reactor.callFromThread(reactor.stop) + try: + if reactor.running: + reactor.callFromThread(reactor.stop) + except NameError: + pass + if self.tcp_serial: self.ser.close() return True