Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Capture Exit Code Using Pipe & Tee

by shmem (Chancellor)
on Jan 31, 2007 at 21:55 UTC ( [id://597644]=note: print w/replies, xml ) Need Help??


in reply to Capture Exit Code Using Pipe & Tee

You need a more elaborate construct to get the return value from make, if you want to execute it in a pipeline via /bin/sh. Try this (untested):
chop (my $status = `((make -f $params 2>&1 3>&-; echo \$? >&3 ) | tee +-a build.log 1>&2 3>&- ) 3>&1`); print "make exit status: $status\n";

update: added backslash to escape $?

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://597644]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-23 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found