diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-02-21 01:16:07 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-02-21 01:53:55 +0000 |
commit | bd5dd39bd07fe748d18beb044ef3bcd0bf79ebab (patch) | |
tree | b486be3bb3cf1c623887d0bf4723a62bd28825e8 | |
parent | 9221b55cee153be455b86858aea89486537206dd (diff) | |
download | morph-bd5dd39bd07fe748d18beb044ef3bcd0bf79ebab.tar.gz |
end ascii encoding hellbaserock/pedroalvarez/unicode-error
Change-Id: I5392c2c762c733d7d88cd20898970ec314525d89
-rw-r--r-- | distbuild/initiator.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/distbuild/initiator.py b/distbuild/initiator.py index 56820fc2..89cd63fd 100644 --- a/distbuild/initiator.py +++ b/distbuild/initiator.py @@ -196,7 +196,7 @@ class Initiator(distbuild.StateMachine): path = self._get_step_output_dir() filename = os.path.join(path, 'build-step-%s.log' % msg['step_name']) - f = codecs.open(filename, 'a', encoding='utf-8') + f = open(filename, 'a') self._step_outputs[msg['step_name']] = f def _close_output(self, msg): @@ -230,8 +230,15 @@ class Initiator(distbuild.StateMachine): step_name = msg['step_name'] if step_name in self._step_outputs: f = self._get_output(msg) - f.write(msg['stdout'].decode('unicode-escape')) - f.write(msg['stderr'].decode('unicode-escape')) + if isinstance(msg['stdout'], unicode): + f.write(msg['stdout'].encode('utf-8')) + else: + f.write(msg['stdout']) + + if isinstance(msg['stderr'], unicode): + f.write(msg['stderr'].encode('utf-8')) + else: + f.write(msg['stderr']) f.flush() else: logging.warning( |