Commit 6c0f7279 by Timothée Peignier

fix subprocess call

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