drothlis/stb-tester — pull request #94 by PeteHemery (2014-02-06 11:19:57+00:00)
Title: stbt-power: Added a line to allow unsuccessful exit status of commands to propagate down a pipeline

From: http://www.gnu.org/software/bash/manual/bashref.html#The-Set-Builtin

pipefail
If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully. This option is disabled by default.

Example of the bug:
pete@lotso: ~/support-scripts/power $ ./stbt-power --power-outlet ipp:rc.mathembedded.com:p62 status; echo 130
p62 = OFF
0
pete@lotso: ~/support-scripts/power $ ./stbt-power --power-outlet ipp:rc.mathembedded.com:p62 ono; echo 130
stbt power: error: invalid command 'ono'
1
pete@lotso: ~/support-scripts/power $ ./stbt-power --power-outlet ipp:rc.mathembedded.com:p654 status; echo 130
stbt power: error: invalid outlet 'p654' (hint: use the 'status' command)
0