Skip to content

Commit

Permalink
bugfix for unicode test cases on machine with ascii locale. changed d…
Browse files Browse the repository at this point in the history
…efault

value of _decode_errors from "strict" to "replace".  closes #123
  • Loading branch information
Andrew Moffat committed Feb 20, 2013
1 parent 4fe3a08 commit f4aa4bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

* Added exit_code attribute to SignalException and ErrorReturnCode exception
classes.

* Bugfix where throwing an ErrorReturnCode exception that had unicode on
a system with ascii encoding would fail a test. [#123](https://github.com/amoffat/sh/issues/123)

* Changed default value for `_decode_errors` from "strict" to "replace". [#123](https://github.com/amoffat/sh/issues/123)


## 1.08 - 1/29/12

Expand All @@ -13,7 +19,7 @@
* Bugfix where CommandNotFound was not being raised if Command was created
by instantiation. [#113](https://github.com/amoffat/sh/issues/113)

* Bugfix for Commands that are wrapped with functools.wraps() [#121](https://github.com/amoffat/sh/issues/121]
* Bugfix for Commands that are wrapped with functools.wraps() [#121](https://github.com/amoffat/sh/issues/121)

* Bugfix where input arguments were being assumed as ascii or unicode, but
never as a string in a different encoding.
Expand Down
5 changes: 3 additions & 2 deletions sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def __init__(self, full_cmd, stdout, stderr):
tstderr += ("... (%d more, please see e.stderr)" % err_delta).encode()

msg = "\n\n RAN: %r\n\n STDOUT:\n%s\n\n STDERR:\n%s" %\
(full_cmd, tstdout.decode(DEFAULT_ENCODING), tstderr.decode(DEFAULT_ENCODING))
(full_cmd, tstdout.decode(DEFAULT_ENCODING, "replace"),
tstderr.decode(DEFAULT_ENCODING, "replace"))
super(ErrorReturnCode, self).__init__(msg)


Expand Down Expand Up @@ -454,7 +455,7 @@ class Command(object):
"tty_out": True,

"encoding": DEFAULT_ENCODING,
"decode_errors": "strict",
"decode_errors": "replace",

# how long the process should run before it is auto-killed
"timeout": 0,
Expand Down

0 comments on commit f4aa4bc

Please sign in to comment.