rattler-build icon indicating copy to clipboard operation
rattler-build copied to clipboard

Improve our bash preamble for better error reporting and less noise

Open wolfv opened this issue 2 years ago • 1 comments

Our bash preamble currently only sources the build_script_env.sh file.

set -x is relatively noisy. We could instead install an error trap and return the line number where the script was failing. Inside the error handler we could also execute e.g. printenv to collect all the current env vars.

wolfv avatar Dec 05 '23 13:12 wolfv

E.g.

error_handler() {
    echo "Error on line $1"
    echo "## ENVIRONMENT ##"
    printenv
}

trap 'error_handler $LINENO' ERR

if [ -z ${CONDA_BUILD+x} ]; then
    source ((script_path))
fi

wolfv avatar Dec 05 '23 13:12 wolfv