diff --git a/create_diracosrc.sh b/create_diracosrc.sh index 5e2cd9f..73ee1b5 100644 --- a/create_diracosrc.sh +++ b/create_diracosrc.sh @@ -12,8 +12,11 @@ echo '' echo '# Initialise the conda environment in a way which ignores other conda installations' echo 'unset CONDA_SHLVL' + echo '# Silence xtrace around the micromamba hook eval (it expands to hundreds of lines)' + echo '__diracos_xtrace=0; case $- in *x*) __diracos_xtrace=1; set +x;; esac' echo 'eval "$(PS1="${PS1:-}" ${DIRACOS}/bin/micromamba shell hook -s bash)"' echo 'micromamba activate "$DIRACOS"' + echo '[ "$__diracos_xtrace" = 1 ] && set -x; unset __diracos_xtrace' echo '' echo '# Silence python warnings' echo 'export PYTHONWARNINGS=ignore' @@ -39,7 +42,11 @@ echo ' if [ -z "${resolvedDir}" ]; then' echo ' return 1' echo ' fi' - echo ' if [ -n "$(ls -A "${resolvedDir}" 2>/dev/null)" ]; then' + echo ' # Silence xtrace so a traced "ls -A" on e.g. a CA cert dir does not dump thousands of lines' + echo ' local _xt=0; case $- in *x*) _xt=1; set +x;; esac' + echo ' local _contents; _contents=$(ls -A "${resolvedDir}" 2>/dev/null)' + echo ' [ "$_xt" = 1 ] && set -x' + echo ' if [ -n "${_contents}" ]; then' echo ' return 0' echo ' fi' echo ' return 1'