Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
3440388a
Commit
3440388a
authored
Feb 16, 2013
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use pipe.communicate
parent
0333ad56
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
40 deletions
+14
-40
pipeline/compilers/__init__.py
+7
-19
pipeline/compressors/__init__.py
+7
-21
No files found.
pipeline/compilers/__init__.py
View file @
3440388a
...
@@ -80,23 +80,11 @@ class SubProcessCompiler(CompilerBase):
...
@@ -80,23 +80,11 @@ 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
pipe
.
stdin
.
write
(
content
)
stdout
,
stderr
=
pipe
.
communicate
(
content
)
pipe
.
stdin
.
close
()
if
stderr
:
raise
CompilerError
(
stderr
)
compressed_content
=
pipe
.
stdout
.
read
()
pipe
.
stdout
.
close
()
error
=
pipe
.
stderr
.
read
()
pipe
.
stderr
.
close
()
if
pipe
.
wait
()
!=
0
:
if
not
error
:
error
=
"Unable to apply
%
s compiler"
%
self
.
__class__
.
__name__
raise
CompilerError
(
error
)
if
self
.
verbose
:
if
self
.
verbose
:
print
(
error
)
print
(
stderr
)
return
stdout
return
compressed_content
pipeline/compressors/__init__.py
View file @
3440388a
...
@@ -229,25 +229,11 @@ class SubProcessCompressor(CompressorBase):
...
@@ -229,25 +229,11 @@ 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
:
try
:
return
content
pipe
.
stdin
.
write
(
smart_bytes
(
content
))
stdout
,
stderr
=
pipe
.
communicate
(
smart_bytes
(
content
))
except
IOError
as
e
:
if
stderr
:
message
=
"Unable to pipe content to command:
%
s"
%
command
raise
CompressorError
(
stderr
)
raise
CompressorError
(
message
,
e
)
pipe
.
stdin
.
close
()
compressed_content
=
pipe
.
stdout
.
read
()
pipe
.
stdout
.
close
()
error
=
pipe
.
stderr
.
read
()
pipe
.
stderr
.
close
()
if
pipe
.
wait
()
!=
0
:
if
not
error
:
error
=
"Unable to apply
%
s compressor"
%
self
.
__class__
.
__name__
raise
CompressorError
(
error
)
if
self
.
verbose
:
if
self
.
verbose
:
print
(
erro
r
)
print
(
stder
r
)
return
compressed_conten
t
return
stdou
t
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment