Afficher un message
Vieux 14/03/2008, 17h29   #1
Teo
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Redirection and additional file descriptors

Hi,

i am using cpan2rpm to generate RPMS from CPAN perl modules. The
script (cpan2rpm is a perl script) uses several non standard file
descriptors for output (i.e., saves the descriptors, redirects some
output to /dev/null, and restores them).

Now I would like to parse the output of cpan2rpm but it seems that is
neither on stdout nor in stderr:

cpan2rpm Class::Accessor > /dev/null 1> /dev/null 2> /dev/null

produces

Generating spec file
SPEC: /usr/src/redhat/SPECS/Class-Accessor.spec
RPM: /usr/src/redhat/RPMS/noarch/perl-Class-
Accessor-0.31-1.noarch.rpm
SRPM: /usr/src/redhat/SRPMS/perl-Class-Accessor-0.31-1.src.rpm

How can I store this output to a variable (or file)?

This is what cpan2rpm does:

open(OLDOUT, ">&STDOUT") || die "std_save(): $!";
open(OLDERR, ">&STDERR") || die "std_save(): $!";
open(OLDIN, "<&STDIN") || die "std_save(): $!";
open(STDOUT, ">/dev/null") || die "std_close(): $!";
open(STDERR, ">/dev/null") || die "std_close(): $!";
open(STDIN, "</dev/null") || die "std_close(): $!";

[...]

open(STDOUT, ">&OLDOUT") || die "std_restore(): $!";
open(STDERR, ">&OLDERR") || die "std_restore(): $!";
open(STDIN, "<&OLDIN") || die "std_restore(): $!";

Many thanks,

Matteo
  Réponse avec citation
 
Page generated in 0,04838 seconds with 9 queries