Unverified Commit a76a530b authored by xoviat's avatar xoviat Committed by GitHub
Browse files

Cleanup suppress function (#72)

parent 6302112b
......@@ -7,6 +7,10 @@ branches:
- master
- devel
cache:
directories:
- $HOME/.ccache
matrix:
allow_failures:
- osx_image: xcode8.3
......
......@@ -18,6 +18,11 @@ if [ $(uname) == "Darwin" ]; then IS_OSX=1; fi
# https://github.com/direnv/direnv/issues/210
shell_session_update() { :; }
# Start a process that runs as a keep-alive
# to avoid travis quitting if there is no output
(while true; do >&2 echo "Travis-CI keep-alive"; sleep 480; done) &
function abspath {
python -c "import os.path; print(os.path.abspath('$1'))"
}
......@@ -61,6 +66,14 @@ function gh-clone {
git clone https://github.com/$1
}
function suppress {
# Suppress the output of a bash command unless it fails
out=$( ( $@ ) 2>&1 )
ret=$?
[ "$ret" -eq 0 ] || >&2 echo "$out" # if $? (the return of the last run command) is not zero, cat the temp file
return "$ret" # return the exit status of the command
}
function rm_mkdir {
# Remove directory if present, then make directory
local path=$1
......
......@@ -56,7 +56,7 @@ function activate_ccache {
ln -s /parent-home/.ccache $HOME/.ccache
# Now install ccache
yum install -y ccache
suppress yum install -y ccache
# Create fake compilers and prepend them to the PATH
# Note that yum is supposed to create these for us,
......
......@@ -6,18 +6,6 @@ source library_builders.sh
# set -e -x
function print_failure {
cat $HOME/suppress.out
exit 1
}
function suppress {
# Suppress the output of a bash command unless it fails
rm -f $HOME/suppress.out 2> /dev/null || true
$* 2>&1 > $HOME/suppress.out || print_failure
rm $HOME/suppress.out
}
if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
suppress build_openssl
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment