[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-porters
Subject:    Re: [perl #27986] IPC::Open3 fails in mod_perl (tie bug)
From:       "Benjamin J. Tilly " <ben_tilly () operamail ! com>
Date:       2004-03-29 21:33:12
Message-ID: 20040329213312.E638F57C079 () ws5-4 ! us4 ! outblaze ! com
[Download RAW message or body]

"Dave Mitchell via RT" <perlbug-followup@perl.org> wrote:
> On Fri, Mar 26, 2004 at 09:02:19PM -0000, Benjamin J. Tilly wrote:
> > It appears that if STDIN is tied when you call open3 from
> > IPC::Open3, directly or through the IPC::Open2 wrapper, you
> > get a silent failure.  The result is that the child process
> > will get no input.  This happens under mod_perl.  (At least
> > with Apache 1.3.)  Looking at source-code, it looks like a tie on
> > STDOUT will also be a problem.
> 
> Thanks, I've applied your patch to bleedperl as change #22609.

Good. :-)

> > The following function shows that data does to a child process
> > offline, but in mod_perl will return nothing:
> > 
> >   use File::Temp 'tempfile';
> >   use IPC::Open2 'open2';
> > 
> >   sub demonstrate_subprocess {
> >     my $out_fh = tempfile();
> >     my $in_fh;
> >     open2($out_fh, $in_fh, "perl", "-e", "print <>")
> >       or die "Cannot run perl: $!";
> >     print $in_fh @_ or die "Error: $!";;
> >     close($in_fh);
> >     return join '', <$out_fh>;
> >   }
> 
> Is it possible to rework this into a test that could be added to
> lib/IPC/Open3.t?

I tried to duplicate the exact mod_perl behaviour, but didn't have
a convenient tie class with enough functionality.

Do you mind a test that crashes without the patch?

Thanks,
Ben
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic