[Rt-commit] rt branch, 4.0/external-jsmin, updated. rt-4.0.1rc1-13-gb034854
Alex Vandiver
alexmv at bestpractical.com
Fri Jun 3 16:23:52 EDT 2011
The branch, 4.0/external-jsmin has been updated
via b03485457d43aba04751a7c7d92076a33021dde5 (commit)
from d80b1e408629b1fb509d4147f3904003a67c1440 (commit)
Summary of changes:
lib/RT/Squish/JS.pm | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit b03485457d43aba04751a7c7d92076a33021dde5
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Jun 2 14:47:44 2011 -0400
Work around IPC::Run3 failure when dealing with TIE'd STDOUT
RT originally introduced safe_run_child in order to work around this
bug; it was removed in ba49022, based on the belief that Plack caused no
filehandles to be TIE'd anymore. Unfortunately, under fastcgi, FCGI
still TIEs STDOUT, leading to server errors when IPC::Run3 attempts to
flip STDOUT back after executing the process. Re-insert the workaround
of setting up dummy STDOUT and STDERR before calling into IPC::Run3.
diff --git a/lib/RT/Squish/JS.pm b/lib/RT/Squish/JS.pm
index d8e0860..f59ed34 100644
--- a/lib/RT/Squish/JS.pm
+++ b/lib/RT/Squish/JS.pm
@@ -92,6 +92,16 @@ sub Filter {
my $input = $content;
my ( $output, $error );
+ # If we're running under fastcgi, STDOUT and STDERR are tied
+ # filehandles, which cause IPC::Run3 to flip out. Construct
+ # temporary, not-tied replacements for it to see instead.
+ my $stdout = IO::Handle->new;
+ $stdout->fdopen( 1, 'w' );
+ local *STDOUT = $stdout;
+ my $stderr = IO::Handle->new;
+ $stderr->fdopen( 2, 'w' );
+ local *STDERR = $stderr;
+
local $SIG{'CHLD'} = 'DEFAULT';
require IPC::Run3;
IPC::Run3::run3( [$jsmin], \$input, \$output, \$error );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list