Skip to content

Commit

Permalink
add logging and error handling helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rhansen committed Jan 31, 2016
1 parent dfc6c70 commit 7c0e443
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/build_test_env.sh
Expand Up @@ -14,6 +14,17 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

pecho() { printf %s\\n "$*"; }
log() {
[ "$#" -eq 0 ] || { pecho "$@"; return 0; }
while IFS= read -r log_line || [ -n "${log_line}" ]; do
log "${log_line}"
done
}
error() { log "ERROR: $@" >&2; }
fatal() { error "$@"; exit 1; }
try() { "$@" || fatal "'$@' failed"; }

PY_VER=2
while getopts :p: opt "$@"; do
case $opt in
Expand Down

0 comments on commit 7c0e443

Please sign in to comment.