Commit 6c0f7279 by Timothée Peignier

fix subprocess call

parent aeae69c8
......@@ -5,7 +5,7 @@ import subprocess
from django.contrib.staticfiles import finders
from django.core.files.base import ContentFile
from django.utils.encoding import smart_str
from django.utils.encoding import smart_str, smart_bytes
from pipeline.conf import settings
from pipeline.exceptions import CompilerError
......@@ -80,8 +80,8 @@ class SubProcessCompiler(CompilerBase):
pipe = subprocess.Popen(command, shell=True, cwd=cwd,
stdout=subprocess.PIPE, stdin=subprocess.PIPE,
stderr=subprocess.PIPE)
if not content:
return content
if content:
content = smart_bytes(content)
stdout, stderr = pipe.communicate(content)
if stderr:
raise CompilerError(stderr)
......
......@@ -229,9 +229,9 @@ class SubProcessCompressor(CompressorBase):
def execute_command(self, command, content):
pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
if not content:
return content
stdout, stderr = pipe.communicate(smart_bytes(content))
if content:
content = smart_bytes(content)
stdout, stderr = pipe.communicate(content)
if stderr:
raise CompressorError(stderr)
if self.verbose:
......
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