fix crash when stdin comes from pipe w/o encoding

This allows, for example, "yes | beet convert".
This commit is contained in:
Adrian Sampson 2012-10-15 14:58:59 -07:00
parent 6115fba765
commit b81ac1d6e0
2 changed files with 2 additions and 1 deletions

View file

@ -132,7 +132,7 @@ def input_(prompt=None):
except EOFError:
raise UserError('stdin stream ended while input required')
return resp.decode(sys.stdin.encoding, 'ignore')
return resp.decode(sys.stdin.encoding or 'utf8', 'ignore')
def input_options(options, require=False, prompt=None, fallback_prompt=None,
numrange=None, default=None, color=False, max_width=72):

View file

@ -56,6 +56,7 @@ Changelog
non-ASCII extensions.
* Fix for changing date fields (like "year") with the :ref:`modify-cmd`
command.
* Fix a crash when input is read from a pipe without a specified encoding.
* Add a human-readable error message when writing files' tags fails.
* Changed plugin loading so that modules can be imported without
unintentionally loading the plugins they contain.