Avoid generating another StringIO instance in StringInputOutput.get_stdout().
authorW. Trevor King <wking@drexel.edu>
Fri, 24 Feb 2012 19:25:21 +0000 (14:25 -0500)
committerW. Trevor King <wking@drexel.edu>
Fri, 24 Feb 2012 19:25:21 +0000 (14:25 -0500)
libbe/command/base.py

index 4e1e41f839449d58cbf087dce49d14425387b5fd..54de8c279fb5df2c93b059564ddf66f058fd3d38 100644 (file)
@@ -483,8 +483,7 @@ class StringInputOutput (InputOutput):
 
     def get_stdout(self):
         ret = self.stdout.getvalue()
-        self.stdout = StringIO.StringIO() # clear stdout for next read
-        self.stdin.encoding = 'utf-8'
+        self.stdout.truncate(size=0)
         return ret
 
 class UnconnectedStorageGetter (object):