summaryrefslogtreecommitdiff
path: root/yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-02-04 11:33:34 +0200
committerLars Wirzenius <liw@liw.fi>2016-02-04 11:33:34 +0200
commit34496ac2e519e41750b0140a92dd36d54e010a95 (patch)
treed995a401d1ca48b2b3ddf319b0357a1d90077240 /yarn
parent0baa5ca17a70bf83d1b4eab340e7e7c32feb60b1 (diff)
downloadcmdtest-34496ac2e519e41750b0140a92dd36d54e010a95.tar.gz
Encode to locale for stdout, stderr; release 0.22cmdtest-0.22
Diffstat (limited to 'yarn')
-rwxr-xr-xyarn13
1 files changed, 9 insertions, 4 deletions
diff --git a/yarn b/yarn
index f1cabb3..2e336b0 100755
--- a/yarn
+++ b/yarn
@@ -19,6 +19,7 @@
import cliapp
import collections
+import locale
import logging
import os
import re
@@ -106,12 +107,16 @@ class YarnRunner(cliapp.Application):
default=False)
def stdout(self, msg):
- self.output.write(msg)
- self.output.flush()
+ self._write(sys.stdout, msg)
def stderr(self, msg):
- sys.stderr.write(msg)
- sys.stderr.flush()
+ self._write(sys.stderr, msg)
+
+ def _write(self, output, msg):
+ if isinstance(msg, unicode):
+ msg = msg.encode(locale.getpreferredencoding())
+ output.write(msg)
+ output.flush()
def info(self, indent, msg):
if self.settings['verbose']: