For reasons I don't understand at the moment, passing \*STDIN and \*STDOUT doesn't work. The following does, though.
my $pid = open3(
'<&STDIN',
'>&STDOUT',
my $fr_chld_err = gensym(),
'email'
)
Tested as follows:
File wrapper:
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open3 qw( open3 );
use Symbol qw( gensym );
my $pid = open3(
'<&STDIN',
'>&STDOUT',
my $fr_chld_err = gensym(),
'email'
);
while (<$fr_chld_err>) {
next if /Module 'eAccelerator' already loaded/;
print STDERR $_;
}
waitpid($pid, 0)
or die;
File email:
#!/usr/bin/perl
use strict;
use warnings;
use IO::Handle qw( );
STDOUT->autoflush(1);
STDERR->autoflush(1);
print STDERR ("PHP Warning: Module 'eAccelerator' already loaded in U
+nknown on line 0\n");
print STDOUT ("[STDOUT]\n");
print STDERR ("[STDERR]\n");
while (<STDIN>) {
print STDERR (">> $_");
}
$ echo meow | wrapper
[STDOUT]
[STDERR]
>> meow
|