Skip to content

Commit

Permalink
Merge pull request #484 from frioux/patch-3
Browse files Browse the repository at this point in the history
Correctly avoid warnings in Plack::App:::WrapCGI
  • Loading branch information
miyagawa committed Dec 18, 2014
2 parents dc92f5c + bff8cb4 commit 58be250
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/Plack/App/WrapCGI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,28 @@ sub prepare_app {
syswrite($stdinw, do {
local $/;
my $fh = $env->{'psgi.input'};
<$fh>;
my $v = <$fh>;
$v = '' unless defined $v;
$v
});
# close STDIN so child will stop waiting
close $stdinw;

my $res = '';
while (waitpid($pid, WNOHANG) <= 0) {
$res .= do { local $/; <$stdoutr> } || '';
$res .= do {
local $/;
my $v = <$stdoutr>;
$v = '' unless defined $v;
$v
};
}
$res .= do { local $/; <$stdoutr> } || '';
$res .= do {
local $/;
my $v = <$stdoutr>;
$v = '' unless defined $v;
$v
};

if (POSIX::WIFEXITED($?)) {
return CGI::Parse::PSGI::parse_cgi_output(\$res);
Expand Down

0 comments on commit 58be250

Please sign in to comment.