mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Use beets shlex_split instead of shlex.split
This commit is contained in:
parent
b4715d61e1
commit
e66981c4d8
1 changed files with 3 additions and 7 deletions
|
|
@ -16,11 +16,11 @@
|
|||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import string
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets.ui import _arg_encoding
|
||||
from beets.util import shlex_split
|
||||
|
||||
|
||||
# Sadly we need this class for {} support due to issue 13598
|
||||
|
|
@ -134,17 +134,13 @@ class HookPlugin(BeetsPlugin):
|
|||
formatter = CodingFormatter(encoding)
|
||||
formatted_command = formatter.format(command, event=event,
|
||||
**kwargs)
|
||||
encoded_formatted_command = formatted_command.encode(encoding)
|
||||
command_pieces = shlex.split(encoded_formatted_command)
|
||||
decoded_command_pieces = map(lambda piece:
|
||||
piece.decode(encoding),
|
||||
command_pieces)
|
||||
command_pieces = shlex_split(formatted_command)
|
||||
|
||||
self._log.debug(u'running command "{0}" for event {1}',
|
||||
formatted_command, event)
|
||||
|
||||
try:
|
||||
subprocess.Popen(decoded_command_pieces).wait()
|
||||
subprocess.Popen(command_pieces).wait()
|
||||
except OSError as exc:
|
||||
self._log.error(u'hook for {0} failed: {1}', event, exc)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue