Skip to content

Commit

Permalink
Fix encoding of subprocess results
Browse files Browse the repository at this point in the history
  • Loading branch information
kostajh committed Jun 21, 2013
1 parent e6018e5 commit a79b4ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions taskw/warrior.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,15 @@ def load_tasks(self, **kw):
pending_tasks = list()
completed_tasks = list()
tasks = dict()
encoding = locale.getdefaultlocale()[1]
pending_tasks = json.loads(subprocess.Popen([
'task', 'rc:%s' % self.config_filename,
'rc.json.array=TRUE', 'rc.verbose=nothing', 'status:pending',
'export'], stdout=subprocess.PIPE).communicate()[0])
'export'], stdout=subprocess.PIPE).communicate()[0].decode(encoding))
completed_tasks = json.loads(subprocess.Popen([
'task', 'rc:%s' % self.config_filename,
'rc.json.array=TRUE', 'rc.verbose=nothing', 'status:completed',
'export'], stdout=subprocess.PIPE).communicate()[0])
'export'], stdout=subprocess.PIPE).communicate()[0].decode(encoding))
tasks['pending'] = pending_tasks
tasks['completed'] = completed_tasks
return tasks
Expand Down

0 comments on commit a79b4ff

Please sign in to comment.