diff options
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | cmdtestlib.py | 2 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rwxr-xr-x | yarn | 13 |
4 files changed, 22 insertions, 5 deletions
@@ -3,6 +3,12 @@ NEWS for cmdtest This file summarizes changes between releases of cmdtest. +Version 0.22, released 2016-02-04 +--------------------------------- + +* Explicitly encode Unicode strings to the preferred locale encoding + when writing to stdout, stderr. + Version 0.21, released 2016-01-25 --------------------------------- diff --git a/cmdtestlib.py b/cmdtestlib.py index 71ce8f5..a750044 100644 --- a/cmdtestlib.py +++ b/cmdtestlib.py @@ -14,7 +14,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -__version__ = '0.21' +__version__ = '0.22' import os diff --git a/debian/changelog b/debian/changelog index c8db0fc..282a905 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cmdtest (0.22-1) unstable; urgency=medium + + * New upstream version. + + -- Lars Wirzenius <liw@liw.fi> Thu, 04 Feb 2016 11:33:30 +0200 + cmdtest (0.21-1) unstable; urgency=medium * New upstream version. @@ -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']: |