Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tasklib/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import re
import six
import subprocess
import locale

from .task import Task, TaskQuerySet, ReadOnlyDictView
from .filters import TaskWarriorFilter
Expand Down Expand Up @@ -142,7 +143,7 @@ def _get_command_args(self, args, config_override=None):
for item in overrides.items():
command_args.append('rc.{0}={1}'.format(*item))
command_args.extend([
x.decode('utf-8') if isinstance(x, six.binary_type)
x.decode(locale.nl_langinfo(locale.CODESET)) if isinstance(x, six.binary_type)
else six.text_type(x) for x in args
])
return command_args
Expand All @@ -152,7 +153,7 @@ def _get_version(self):
self._get_task_command() + ['--version'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = [x.decode('utf-8') for x in p.communicate()]
stdout, stderr = [x.decode(locale.nl_langinfo(locale.CODESET)) for x in p.communicate()]
return stdout.strip('\n')

def _get_modified_task_fields_as_args(self, task):
Expand Down Expand Up @@ -287,7 +288,7 @@ def execute_command(self, args, config_override=None, allow_failure=True,
env['TASKRC'] = self.taskrc_location
p = subprocess.Popen(command_args, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
stdout, stderr = [x.decode('utf-8') for x in p.communicate()]
stdout, stderr = [x.decode(locale.nl_langinfo(locale.CODESET)) for x in p.communicate()]
if p.returncode and allow_failure:
if stderr.strip():
error_msg = stderr.strip()
Expand Down