From e66981c4d837f8a8f93ce9fde17c17b57cb954d0 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Sun, 1 May 2016 21:31:53 +0100 Subject: [PATCH] Use beets shlex_split instead of shlex.split --- beetsplug/hook.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/beetsplug/hook.py b/beetsplug/hook.py index d3a1fbdb8..b2eec360c 100644 --- a/beetsplug/hook.py +++ b/beetsplug/hook.py @@ -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)