summaryrefslogtreecommitdiff
path: root/cmd2/utils.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-04-11 18:21:00 -0400
committerGitHub <noreply@github.com>2019-04-11 18:21:00 -0400
commit4177e0fcd2daada9893c08161e55f9a7a0adaac5 (patch)
tree27f10c95e8a672d86274e6e963c904661186ed1f /cmd2/utils.py
parentf5c904cda48c03a30b3476f3a40224226391deea (diff)
parent1f08873a0bc46e90c5eb1bff63061688acc3c4fb (diff)
downloadcmd2-git-4177e0fcd2daada9893c08161e55f9a7a0adaac5.tar.gz
Merge pull request #664 from python-cmd2/pointer_bug
Fixed issue where pointer to bytearray was being returned instead of copied bytes
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r--cmd2/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py
index d8ac513d..35c953e0 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -325,7 +325,7 @@ class StdSim(object):
def getbytes(self) -> bytes:
"""Get the internal contents as bytes"""
- return self.buffer.byte_buf
+ return bytes(self.buffer.byte_buf)
def read(self) -> str:
"""Read from the internal contents as a str and then clear them out"""
@@ -341,7 +341,7 @@ class StdSim(object):
def clear(self) -> None:
"""Clear the internal contents"""
- self.buffer.byte_buf = bytearray()
+ self.buffer.byte_buf.clear()
def isatty(self) -> bool:
"""StdSim only considered an interactive stream if `echo` is True and `inner_stream` is a tty."""