mirror of
https://github.com/JoelBender/bacpypes
synced 2025-10-05 22:18:16 +08:00
check to see if the application is running interactively (using isatty) and be a little quieter
This commit is contained in:
parent
df21d273ab
commit
f4afe0ce19
|
@ -44,8 +44,16 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
cmd.Cmd.__init__(self, stdin=stdin, stdout=stdout)
|
cmd.Cmd.__init__(self, stdin=stdin, stdout=stdout)
|
||||||
Thread.__init__(self, name="ConsoleCmd")
|
Thread.__init__(self, name="ConsoleCmd")
|
||||||
|
|
||||||
# save the prompt and exec option
|
# check to see if this is running interactive
|
||||||
|
self.interactive = sys.__stdin__.isatty()
|
||||||
|
|
||||||
|
# save the prompt for interactive sessions, otherwise be quiet
|
||||||
|
if self.interactive:
|
||||||
self.prompt = prompt
|
self.prompt = prompt
|
||||||
|
else:
|
||||||
|
self.prompt = ''
|
||||||
|
|
||||||
|
# save the exec option
|
||||||
self.allow_exec = allow_exec
|
self.allow_exec = allow_exec
|
||||||
|
|
||||||
# gc counters
|
# gc counters
|
||||||
|
@ -272,9 +280,13 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
if not isinstance(err, IOError):
|
if not isinstance(err, IOError):
|
||||||
self.stdout.write("history error: %s\n" % err)
|
self.stdout.write("history error: %s\n" % err)
|
||||||
|
|
||||||
cmd.Cmd.postloop(self) ## Clean up command completion
|
# clean up command completion
|
||||||
|
cmd.Cmd.postloop(self)
|
||||||
|
|
||||||
|
if self.interactive:
|
||||||
self.stdout.write("Exiting...\n")
|
self.stdout.write("Exiting...\n")
|
||||||
|
|
||||||
|
# tell the core we have stopped
|
||||||
core.stop()
|
core.stop()
|
||||||
|
|
||||||
def precmd(self, line):
|
def precmd(self, line):
|
||||||
|
|
|
@ -45,8 +45,16 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
cmd.Cmd.__init__(self, stdin=stdin, stdout=stdout)
|
cmd.Cmd.__init__(self, stdin=stdin, stdout=stdout)
|
||||||
Thread.__init__(self, name="ConsoleCmd")
|
Thread.__init__(self, name="ConsoleCmd")
|
||||||
|
|
||||||
# save the prompt and exec option
|
# check to see if this is running interactive
|
||||||
|
self.interactive = sys.__stdin__.isatty()
|
||||||
|
|
||||||
|
# save the prompt for interactive sessions, otherwise be quiet
|
||||||
|
if self.interactive:
|
||||||
self.prompt = prompt
|
self.prompt = prompt
|
||||||
|
else:
|
||||||
|
self.prompt = ''
|
||||||
|
|
||||||
|
# save the exec option
|
||||||
self.allow_exec = allow_exec
|
self.allow_exec = allow_exec
|
||||||
|
|
||||||
# gc counters
|
# gc counters
|
||||||
|
@ -273,9 +281,13 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
if not isinstance(err, IOError):
|
if not isinstance(err, IOError):
|
||||||
self.stdout.write("history error: %s\n" % err)
|
self.stdout.write("history error: %s\n" % err)
|
||||||
|
|
||||||
cmd.Cmd.postloop(self) ## Clean up command completion
|
# clean up command completion
|
||||||
|
cmd.Cmd.postloop(self)
|
||||||
|
|
||||||
|
if self.interactive:
|
||||||
self.stdout.write("Exiting...\n")
|
self.stdout.write("Exiting...\n")
|
||||||
|
|
||||||
|
# tell the core we have stopped
|
||||||
core.stop()
|
core.stop()
|
||||||
|
|
||||||
def precmd(self, line):
|
def precmd(self, line):
|
||||||
|
|
|
@ -45,8 +45,16 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
cmd.Cmd.__init__(self, stdin=stdin, stdout=stdout)
|
cmd.Cmd.__init__(self, stdin=stdin, stdout=stdout)
|
||||||
Thread.__init__(self, name="ConsoleCmd")
|
Thread.__init__(self, name="ConsoleCmd")
|
||||||
|
|
||||||
# save the prompt and exec option
|
# check to see if this is running interactive
|
||||||
|
self.interactive = sys.__stdin__.isatty()
|
||||||
|
|
||||||
|
# save the prompt for interactive sessions, otherwise be quiet
|
||||||
|
if self.interactive:
|
||||||
self.prompt = prompt
|
self.prompt = prompt
|
||||||
|
else:
|
||||||
|
self.prompt = ''
|
||||||
|
|
||||||
|
# save the exec option
|
||||||
self.allow_exec = allow_exec
|
self.allow_exec = allow_exec
|
||||||
|
|
||||||
# gc counters
|
# gc counters
|
||||||
|
@ -274,9 +282,13 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
if not isinstance(err, IOError):
|
if not isinstance(err, IOError):
|
||||||
self.stdout.write("history error: %s\n" % err)
|
self.stdout.write("history error: %s\n" % err)
|
||||||
|
|
||||||
cmd.Cmd.postloop(self) ## Clean up command completion
|
# clean up command completion
|
||||||
|
cmd.Cmd.postloop(self)
|
||||||
|
|
||||||
|
if self.interactive:
|
||||||
self.stdout.write("Exiting...\n")
|
self.stdout.write("Exiting...\n")
|
||||||
|
|
||||||
|
# tell the core we have stopped
|
||||||
core.stop()
|
core.stop()
|
||||||
|
|
||||||
def precmd(self, line):
|
def precmd(self, line):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user