summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd2/cmd2.py11
-rw-r--r--cmd2/utils.py4
2 files changed, 9 insertions, 6 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index c9ac6068..6c0f0f90 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -694,22 +694,21 @@ class Cmd(cmd.Cmd):
pager = self.pager
if chop:
pager = self.pager_chop
- self.pipe_proc = subprocess.Popen(pager, shell=True, stdin=subprocess.PIPE)
+ pipe_proc = subprocess.Popen(pager, shell=True, stdin=subprocess.PIPE)
try:
- self.pipe_proc.stdin.write(msg_str.encode('utf-8', 'replace'))
- self.pipe_proc.stdin.close()
+ pipe_proc.stdin.write(msg_str.encode('utf-8', 'replace'))
+ pipe_proc.stdin.close()
except (OSError, KeyboardInterrupt):
pass
# Less doesn't respect ^C, but catches it for its own UI purposes (aborting search etc. inside less)
while True:
try:
- self.pipe_proc.wait()
+ pipe_proc.wait()
except KeyboardInterrupt:
pass
else:
break
- self.pipe_proc = None
else:
self.decolorized_write(self.stdout, msg_str)
except BrokenPipeError:
@@ -1655,7 +1654,7 @@ class Cmd(cmd.Cmd):
:param frame
"""
- # Save copy of pipe_proc since it could theoretically change while this is running
+ # Save copy of pipe_proc_reader since it could theoretically change while this is running
pipe_proc_reader = self.pipe_proc_reader
if pipe_proc_reader is not None:
diff --git a/cmd2/utils.py b/cmd2/utils.py
index d14ef90f..2db6a267 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -345,6 +345,10 @@ class StdSim(object):
"""Clear the internal contents"""
self.buffer.byte_buf = b''
+ def isatty(self) -> bool:
+ """StdSim will never be considered an interactive stream"""
+ return False
+
def __getattr__(self, item: str):
if item in self.__dict__:
return self.__dict__[item]