[Fusioninventory-devel] [Help] how to capture STDERR with -| open syntax

Gonéri Le Bouder goneri at rulezlan.org
Fri Nov 12 16:01:48 UTC 2010


On Fri, Nov 12, 2010 at 01:02:48PM +0100, Guillaume Rousse wrote:
> Le 12/11/2010 10:46, Gonéri Le Bouder a écrit :
> > Hi,
> > 
> > A little Perl question. Do you know if it possible to catpure STDERR with
> > this syntax:
> > if (open my $handle, "-|", "ddcprobe") {
> > ...
> > }
> Redirect stderr output to stdin: open ($handle, '|', 'dccprobe 2>&1').
This doesn't work:
Unknown open() mode '|'

This is what I did finally:
    my $handle;
    if ($file) {
        open $handle, '<', $file or die;
    } else {
        open ($handle, "ddcprobe 2>&1 |")
    }
    foreach (<$handle>) {

Best regards,

    Gonéri

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/fusioninventory-devel/attachments/20101112/43f8cc40/attachment.pgp>


More information about the Fusioninventory-devel mailing list