system return value?

system return value?

am 26.01.2007 23:52:27 von g4173c

Greetings:

I'm doing the following:

system ("make | tee /tmp/make.log") == 0 || die "Make failed $?\n";

The problem is that the pipe tee is what is getting returned for a
status. Is there anyway around this problem? The make fails but my
script doesn't exit out....

Thanks in advance!
Tom

Re: system return value?

am 27.01.2007 08:58:48 von Morten Guldager

2007-01-26 g4173c@motorola.com wrote
> Greetings:
>
> I'm doing the following:
>
> system ("make | tee /tmp/make.log") == 0 || die "Make failed $?\n";
>
> The problem is that the pipe tee is what is getting returned for a
> status. Is there anyway around this problem? The make fails but my
> script doesn't exit out....

How about launching your "make" in a open call?

open MAKE, "make|" or die "open: $!";
while ()
{
print STDERR $_;
}
my $exit_code_from_make = close MAKE;



/Morten %-)

Re: system return value?

am 02.02.2007 22:13:17 von Big and Blue

g4173c@motorola.com wrote:
> Greetings:
>
> I'm doing the following:
>
> system ("make | tee /tmp/make.log") == 0 || die "Make failed $?\n";
>
> The problem is that the pipe tee is what is getting returned for a
> status. Is there anyway around this problem? The make fails but my
> script doesn't exit out....

How perverse do you wish to be:

system 'var=`((make; echo $?>&3) | tee /tmp/make.log) 3>&1`; exit $var ';


--
Just because I've written it doesn't mean that
either you or I have to believe it.

Re: system return value?

am 08.02.2007 19:36:53 von g4173c

On Feb 2, 4:13 pm, Big and Blue wrote:

>
> system 'var=`((make; echo $?>&3) | tee /tmp/make.log) 3>&1`; exit $var ';
>

Interesting, but it no longer gets any output to the screen. Does get
the exit
status.

Tom