[test] Make sys.stdout compatible with both Python 2 & 3

This time's the charm.

llvm-svn: 370552
This commit is contained in:
Jonas Devlieghere 2019-08-30 23:54:13 +00:00
parent d21a3e41a4
commit 1ea909270c
1 changed files with 2 additions and 1 deletions

View File

@ -28,7 +28,8 @@ else:
self.child.expect_exact(self.PROMPT) self.child.expect_exact(self.PROMPT)
def launch(self, executable=None, timeout=30, dimensions=None): def launch(self, executable=None, timeout=30, dimensions=None):
logfile = sys.stdout.buffer if self.TraceOn() else None logfile = getattr(sys.stdout, 'buffer',
sys.stdout) if self.TraceOn() else None
args = ['--no-lldbinit', '--no-use-colors'] args = ['--no-lldbinit', '--no-use-colors']
for cmd in self.setUpCommands(): for cmd in self.setUpCommands():
args += ['-O', cmd] args += ['-O', cmd]