Commit 5b8d50b5 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

py2/py3: subprocesstransform.convert() argument can by str in Python 3.

parent d66806a8
...@@ -5,6 +5,7 @@ import tempfile ...@@ -5,6 +5,7 @@ import tempfile
import re import re
import shutil import shutil
from os.path import join, basename from os.path import join, basename
import six
from zope.interface import implementer from zope.interface import implementer
...@@ -159,6 +160,8 @@ class subprocesstransform: ...@@ -159,6 +160,8 @@ class subprocesstransform:
argument_list = shlex.split(command) argument_list = shlex.split(command)
process = Popen(argument_list, stdin=stdin_file, stdout=PIPE, process = Popen(argument_list, stdin=stdin_file, stdout=PIPE,
stderr=PIPE, close_fds=True) stderr=PIPE, close_fds=True)
if six.PY3 and isinstance(data, str):
data = data.encode()
data_out, data_err = process.communicate(input=data) data_out, data_err = process.communicate(input=data)
if process.returncode: if process.returncode:
raise OSError(data_err) # XXX raise OSError(data_err) # XXX
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment