Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Capture Exit Code Using Pipe & Tee

by ikegami (Patriarch)
on Jan 31, 2007 at 20:55 UTC ( [id://597635]=note: print w/replies, xml ) Need Help??


in reply to Capture Exit Code Using Pipe & Tee

The exit value is always 0, because it's returning the tee value, and not make. Any and all help is very apprciated.

Not quite. It's returning the error code of the shell invoked to execute the command. system sometimes, but not always, passes the command to /bin/sh. This is one of those times. See the docs for details.

Replies are listed 'Best First'.
Re^2: Capture Exit Code Using Pipe & Tee
by Tanktalus (Canon) on Jan 31, 2007 at 22:09 UTC

    Both true and untrue misleading(?). It's getting the return/error code of the shell, yes. However, the shell is getting it from the tee command. If tee were to return 1, the shell would return 1, regardless of what make did.

    merlyn's answer is definitely the right track. Doing this in perl is actually not that bad, and though it may take more code than shmem's response, I'm not sure it'd be less readable ;-)

      No, it doesn't necessarily get it from the tee command, and it always gets it from the shell when the it is called. I can think of three circumstances where it does not.

      • If the shell can't execute tee, the error code would not be that of tee.
      • If the shell exits due to a signal or a core dump, the error code would not be that of tee. (Right?)
      • If the script runs under Windows and tee returns an error code greater than 1, the error code returned would be 1.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-24 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found