mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
reencode convert args on py3 for util.command_output
command_output requires bytestrings, so we put em back that way.
This commit is contained in:
parent
e5497c7494
commit
1b103b087b
1 changed files with 6 additions and 1 deletions
|
|
@ -190,18 +190,23 @@ class ConvertPlugin(BeetsPlugin):
|
|||
dest = dest.decode(ui._arg_encoding(), 'surrogateescape')
|
||||
|
||||
args = shlex.split(command)
|
||||
encode_cmd = []
|
||||
for i, arg in enumerate(args):
|
||||
args[i] = Template(arg).safe_substitute({
|
||||
'source': source,
|
||||
'dest': dest,
|
||||
})
|
||||
if six.PY2:
|
||||
encode_cmd.append(args[i])
|
||||
else:
|
||||
encode_cmd.append(args[i].encode(ui._arg_encoding()))
|
||||
|
||||
if pretend:
|
||||
self._log.info(u' '.join(ui.decargs(args)))
|
||||
return
|
||||
|
||||
try:
|
||||
util.command_output(args)
|
||||
util.command_output(encode_cmd)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
# Something went wrong (probably Ctrl+C), remove temporary files
|
||||
self._log.info(u'Encoding {0} failed. Cleaning up...',
|
||||
|
|
|
|||
Loading…
Reference in a new issue