Skip to content

Commit

Permalink
Item14205: Probably fixed STDOUT/STDERR capturing under FCGI control.
Browse files Browse the repository at this point in the history
  • Loading branch information
vrurg committed Nov 8, 2016
1 parent a7b968a commit 74d590a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions FastCGIEngineContrib/lib/Foswiki/Engine/FastCGI.pm
Expand Up @@ -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;

Expand Down Expand Up @@ -187,7 +193,8 @@ sub preparePath {
}

sub write {
syswrite STDOUT, $_[1];
my $this = shift;
syswrite $this->{fhOUT}, $_[0];
}

sub closeSocket {
Expand Down
4 changes: 3 additions & 1 deletion core/lib/Foswiki/Configure/Wizards/AutoConfigureEmail.pm
Expand Up @@ -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 {
Expand Down

0 comments on commit 74d590a

Please sign in to comment.