From c11dec9ca541127a8cb46f540cd346642e8beb67 Mon Sep 17 00:00:00 2001 From: Joel Bender Date: Fri, 29 Jan 2016 15:29:30 -0500 Subject: [PATCH] defer the call to stop because it may be called before run, depending on threading --- py27/bacpypes/consolecmd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/py27/bacpypes/consolecmd.py b/py27/bacpypes/consolecmd.py index e9311c8..643e271 100755 --- a/py27/bacpypes/consolecmd.py +++ b/py27/bacpypes/consolecmd.py @@ -78,7 +78,7 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging): if _debug: ConsoleCmd._debug(" - done cmdloop") # tell the main thread to stop, this thread will exit - core.stop() + core.deferred(core.stop) def onecmd(self, cmdString): if _debug: ConsoleCmd._debug('onecmd %r', cmdString) @@ -242,6 +242,7 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging): def do_shell(self, args): """Pass command to a system shell when line begins with '!'""" + if _debug: ConsoleCmd._debug("do_shell %r", args) os.system(args) def do_help(self, args): @@ -249,6 +250,7 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging): 'help' or '?' with no arguments prints a list of commands for which help is available 'help ' or '? ' gives help on """ + if _debug: ConsoleCmd._debug("do_exit %r", args) ## The only reason to define this method is for the help text in the doc string cmd.Cmd.do_help(self, args) @@ -281,7 +283,7 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging): self.stdout.write("Exiting...\n") # tell the core we have stopped - core.stop() + core.deferred(core.stop) def precmd(self, line): """ This method is called after the line has been input but before