Permalink
Browse files

Item14205: Probably fixed STDOUT/STDERR capturing under FCGI control.

  • Loading branch information...
vrurg committed Nov 8, 2016
1 parent a7b968a commit 74d590a945a0fbd96a5af6c48c8aecbe3f4ee589
@@ -65,7 +65,13 @@ sub run {
or die "Failed to create FastCGI socket: $!";
}
$args ||= {};
- my $r = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%ENV, $sock,
+
+ # Prepare output handles for FastCGI.
+ $this->{$_} = IO::Handle->new foreach qw(fhOUT fhERR);
+ # This is a little trick to make all `print STDERR' clauses send their
+ # output to the log file.
+ STDERR->fdopen($this->{fhERR}->fileno, "w");
+ my $r = FCGI::Request( \*STDIN, $this->{fhOUT}, $this->{fhERR}, \%ENV, $sock,
&FCGI::FAIL_ACCEPT_ON_INTR );
my $manager;
@@ -187,7 +193,8 @@ sub preparePath {
}
sub write {
- syswrite STDOUT, $_[1];
+ my $this = shift;
+ syswrite $this->{fhOUT}, $_[0];
}
sub closeSocket {
@@ -255,7 +255,9 @@ NOCERT
if ( $Foswiki::cfg{SMTP}{MAILHOST} ) {
- if ( $Foswiki::cfg{Engine} && $Foswiki::cfg{Engine} !~ m/FastCGI$/ ) {
+ if ( 1
+ || $Foswiki::cfg{Engine} && $Foswiki::cfg{Engine} !~ m/FastCGI$/ )
+ {
( $ok, $out, $err ) = _muteExec( \&_autoconfigSMTP, $reporter );
}
else {

0 comments on commit 74d590a

Please sign in to comment.