From f2f708f6985dd3a7c51869c0dda5791ca239d248 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Mon, 21 May 2018 20:34:29 -0400 Subject: good stuff --- Bugzilla/Quantum/CGI.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Bugzilla/Quantum/CGI.pm') diff --git a/Bugzilla/Quantum/CGI.pm b/Bugzilla/Quantum/CGI.pm index 5ccda4d6f..c0fb04c22 100644 --- a/Bugzilla/Quantum/CGI.pm +++ b/Bugzilla/Quantum/CGI.pm @@ -10,6 +10,7 @@ use Mojo::Base 'Mojolicious::Controller'; use CGI::Compile; use Bugzilla::Constants qw(bz_locations); +use Bugzilla::Quantum::Stdout; use File::Slurper qw(read_text); use File::Spec::Functions qw(catfile); use Sub::Name; @@ -60,24 +61,20 @@ sub _load_cgi { my ($c) = @_; my $stdin = $c->_STDIN; my $stdout = ''; - local $Bugzilla::C = $c; local %ENV = $c->_ENV; local *STDIN; ## no critic (local) - local *STDOUT; ## no critic (local) local $CGI::Compile::USE_REAL_EXIT = 0; local $PROGRAM_NAME = $file; open STDIN, '<', $stdin->path or die "STDIN @{[$stdin->path]}: $!" if -s $stdin->path; - open STDOUT, '>', \$stdout or die "STDOUT capture: $!"; + tie STDOUT, 'Bugzilla::Quantum::Stdout', controller => $c; ## no critic (tie) try { Bugzilla->init_page(); $inner->(); } catch { - $c->render(text => $_); die $_ unless ref $_ eq 'ARRAY' && $_->[0] eq "EXIT\n" || /\bModPerl::Util::exit\b/; } finally { - $c->res->body($stdout) if $stdout; Bugzilla->_cleanup; ## no critic (private) CGI::initialize_globals(); }; @@ -146,4 +143,4 @@ sub _STDIN { return Mojo::Asset::File->new->add_chunk( $stdin->slurp ); } -1; \ No newline at end of file +1; -- cgit v1.2.3-24-g4f1b