Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: best practices for checking system return values for piped commands?

by Hue-Bond (Priest)
on May 01, 2006 at 20:17 UTC ( #546754=note: print w/replies, xml ) Need Help??


in reply to best practices for checking system return values for piped commands?

The error checking doesn't work correctly on the last one ("boom|true"), so it fails. I believe this happens because although boom fails, something is sent through the pipe, and 'true' succeeds on the other end of the pipe.

On a Linux 2.6, with a bash shell:

$ boom|true; echo $? bash: boom: command not found 0 $ _

This is because, according to the documentation of my shell, The return status of a pipeline is the exit status of the last command, unless the pipefail option is enabled. So, if your shell works like bash in this respect, your tests are returning the results they should.

--
David Serrano

  • Comment on Re: best practices for checking system return values for piped commands?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://546754]
help
Chatterbox?
[GotToBTru]: same here Corion.
[Corion]: I tried for a short time (well, 8 hours now) to get Perl::Tidy set up but then found that it doesn't support (new-style) signatures and then stopped again ;))
[GotToBTru]: changing the font color of the rest of the document just because I typed a single quote character is annoying

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2017-02-27 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (385 votes). Check out past polls.