Hmmm, I'm interested as to the difference in the manner with which you treat the calls to open ... when open'ing the file you check for failure, but you fail (pun intended) so to do with the command.
I think you'll find that your requirement will be met if you chose to do so i.e.
open CMD, "some_command |" or lprint("Command: some_command failed - $
+!"), exit 1;