Click here to get back home

system return value?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
system return value? g4173c 01-26-2007
Posted by g4173c on January 26, 2007, 5:52 pm
Please log in for more thread options


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


Posted by Morten Guldager on January 27, 2007, 2:58 am
Please log in for more thread options


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 (<MAKE>)
{
print STDERR $_;
}
my $exit_code_from_make = close MAKE;



/Morten %-)

Posted by Big and Blue on February 2, 2007, 4:13 pm
Please log in for more thread options


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.

Posted by g4173c on February 8, 2007, 1:36 pm
Please log in for more thread options



>
> 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


Similar ThreadsPosted
Net::Cmd::code doesn't return value of Net::Cmd::dataend January 10, 2005, 9:17 pm
Parsing return message from fetchmail June 27, 2006, 3:04 pm
SSH Modules: Accessing CLI box using SSH and not getting the return output?? November 12, 2006, 11:48 pm
Net::SSH::W32Perl Script hanging when trying to return data March 10, 2005, 1:14 pm
Net::SSH::W32Perl Script hanging when trying to return data March 10, 2005, 1:30 pm
Return keys from $db->DataHash directly into an array September 16, 2007, 11:56 am
Module to return Local Policy Info July 13, 2008, 1:50 pm
perl script for uploading photo and getting the return value of submit February 28, 2006, 1:03 am
$db->DataHash does not return keys/fields in same order as they appear in database September 16, 2007, 11:59 am
How to deal with "{" in system("...command..."); ? August 13, 2008, 8:42 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap