mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +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
|
from __future__ import division, absolute_import, print_function
|
||||||
|
|
||||||
import string
|
import string
|
||||||
import shlex
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from beets.plugins import BeetsPlugin
|
from beets.plugins import BeetsPlugin
|
||||||
from beets.ui import _arg_encoding
|
from beets.ui import _arg_encoding
|
||||||
|
from beets.util import shlex_split
|
||||||
|
|
||||||
|
|
||||||
# Sadly we need this class for {} support due to issue 13598
|
# Sadly we need this class for {} support due to issue 13598
|
||||||
|
|
@ -134,17 +134,13 @@ class HookPlugin(BeetsPlugin):
|
||||||
formatter = CodingFormatter(encoding)
|
formatter = CodingFormatter(encoding)
|
||||||
formatted_command = formatter.format(command, event=event,
|
formatted_command = formatter.format(command, event=event,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
encoded_formatted_command = formatted_command.encode(encoding)
|
command_pieces = shlex_split(formatted_command)
|
||||||
command_pieces = shlex.split(encoded_formatted_command)
|
|
||||||
decoded_command_pieces = map(lambda piece:
|
|
||||||
piece.decode(encoding),
|
|
||||||
command_pieces)
|
|
||||||
|
|
||||||
self._log.debug(u'running command "{0}" for event {1}',
|
self._log.debug(u'running command "{0}" for event {1}',
|
||||||
formatted_command, event)
|
formatted_command, event)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.Popen(decoded_command_pieces).wait()
|
subprocess.Popen(command_pieces).wait()
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
self._log.error(u'hook for {0} failed: {1}', event, exc)
|
self._log.error(u'hook for {0} failed: {1}', event, exc)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue