Skip to content

Commit

Permalink
subprocess is expecting bytestrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Mar 7, 2014
1 parent 1a868cf commit 16e9d00
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions taskw/warrior.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,14 +448,22 @@ def _execute(self, *args):
+ self.get_configuration_override_args()
+ [six.text_type(arg) for arg in args]
)

# subprocess is expecting bytestrings only, so nuke unicode if present
for i in range(len(command)):
if isinstance(command[i], six.text_type):
command[i] = command[i].encode('utf-8')

proc = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
stdout, stderr = proc.communicate()

if proc.returncode != 0:
raise TaskwarriorError(command, stderr, stdout, proc.returncode)

return stdout, stderr

def _get_json(self, *args):
Expand Down

0 comments on commit 16e9d00

Please sign in to comment.