1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

defer the call to stop because it may be called before run, depending on threading

This commit is contained in:
Joel Bender 2016-01-29 15:29:30 -05:00
parent feed95186e
commit c11dec9ca5

View File

@ -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 <command>' or '? <command>' gives help on <command>
"""
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