summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2015-10-04 09:30:50 +0100
committerThomas Kluyver <takowl@gmail.com>2015-10-04 09:34:07 +0100
commitd71e4835f421ba61b147d1f7b0d7de3d81c46b5a (patch)
treee053d33a899cd4526c347f65706e0f6d114177fc
parentb3b4f625fbe294d40f86726a2c97168b7a27d04c (diff)
downloadpexpect-git-d71e4835f421ba61b147d1f7b0d7de3d81c46b5a.tar.gz
Collect output as list instead of string
This is supposed to be more efficient
-rw-r--r--pexpect/replwrap.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pexpect/replwrap.py b/pexpect/replwrap.py
index 11ec4d0..8d767c3 100644
--- a/pexpect/replwrap.py
+++ b/pexpect/replwrap.py
@@ -84,11 +84,11 @@ class REPLWrapper(object):
if not cmdlines:
raise ValueError("No command was given")
- res = u''
+ res = []
self.child.sendline(cmdlines[0])
for line in cmdlines[1:]:
self._expect_prompt(timeout=timeout)
- res += self.child.before
+ res.append(self.child.before)
self.child.sendline(line)
# Command was fully submitted, now wait for the next prompt
@@ -98,7 +98,7 @@ class REPLWrapper(object):
self._expect_prompt(timeout=1)
raise ValueError("Continuation prompt found - input was incomplete:\n"
+ command)
- return res + self.child.before
+ return u''.join(res + [self.child.before])
def python(command="python"):
"""Start a Python shell and return a :class:`REPLWrapper` object."""