Commit 0280d385 authored by Bogdan Vacaliuc's avatar Bogdan Vacaliuc
Browse files

perform shellcheck and modify code to obtain clean report

+ apply suggestions from SC2086 on quoting
- disable SC2206 on array concatention to keep elements separate
- disable SC2076 on regex comparison b/c it is not syntactically correct
parent e7135193
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ fi

# execute main app in background
TMP=$(mktemp)
nsd-conda-wrap.sh ${ENV} --classic ${CMD} $@ > ${TMP} & pid=$!
nsd-conda-wrap.sh "${ENV}" --classic "${CMD}" "$@" > "${TMP}" & pid=$!

# deal with background app under CTRL-C and exit conditions
trap 'set -x ; kill -HUP $pid' SIGINT
@@ -68,10 +68,13 @@ trap 'set -x ; wait $pid' EXIT

# execute profile process in foreground
args=("$PROFILE_ENV" "--classic" "-m" "mantidprofiler")
# shellcheck disable=SC2206 # do not break the array into a single string
args+=(${PROFILE_OPT[@]})
args+=("${pid}")
if nsd-conda-wrap.sh ${args[@]} ; then
if nsd-conda-wrap.sh "${args[@]}" ; then
    # https://superuser.com/a/1732848
    # shellcheck disable=SC2199 # use implicit concatenation
    # shellcheck disable=SC2076 # rhs quoted syntax is correct
    if [[ "${PROFILE_OPT[@]}" =~ "--outfile ([^ ]+) " ]]; then
        echo "Wrote ${BASH_REMATCH[1]}"
    else