- echo "-----> Running tox $env"
- if ! tox -e $env > "$log_dir/tox-$env.log"; then
- echo "$env" >> "$log_dir/failed-envs.log"
+
+# $TOX_OPTIONS_LIST are intentionnaly not surrounded by quotes
+# to correcly pass options to tox
+# shellcheck disable=SC2086
+tox $TOX_OPTIONS_LIST | tee -a "$ARCHIVE_TOX_DIR/tox.log"
+tox_status="${PIPESTATUS[0]}"
+
+echo "---> Completed tox runs"
+
+# Disable SC2116 as we want to echo a space separated list of TOX_ENVS
+# shellcheck disable=SC2116
+for i in .tox/*/log; do
+ tox_env=$(echo "$i" | awk -F'/' '{print $2}')
+ # defend against glob finding no matches
+ if ! cp -r "$i" "$ARCHIVE_TOX_DIR/$tox_env"; then
+ echo "WARN: no logs found to archive"
+ break