Commit 0e2dd326 authored by Bogdan Vacaliuc's avatar Bogdan Vacaliuc
Browse files

both process in background, follow script output

parent 16f66e60
Loading
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -84,9 +84,17 @@ echo "Writing script output to ${TMP}"
trap 'set -x ; kill -HUP $pid' SIGINT
trap 'set -x ; wait $pid' EXIT

# execute profile process in foreground
# execute profile process in background
PTMP=$(mktemp)
args=("$PROFILE_ENV" "--classic" "-m" "mantidprofiler")
# shellcheck disable=SC2206 # do not break the array into a single string
args+=(${PROFILE_OPT[@]})
args+=("${pid}")
nsd-conda-wrap.sh "${args[@]}" && echo "Wrote ${PROFILE_OUT}"
nsd-conda-wrap.sh "${args[@]}" > ${PTMP} & ppid=$i
echo "Writing profile output to ${PTMP}"
trap 'set -x ; kill -HUP $pid $ppid' SIGINT

# follow output from main app and cleanup
tail -f ${TMP} --pid $pid
wait -n $ppid && echo "Wrote ${PROFILE_OUT}"
trap - EXIT