<commit_before>#!/bin/bash
# Small spinner script, that returns exit code of CMD and keeps colored output
# Usage: ./spinner CMD

spinner() {
	local PID=$1
	local SPIN="/-\|"
	local i=0
	while kill -0 $PID >/dev/null 2>&1; do
		printf "\r%s" "${SPIN:$i:1}"
		i=$(($i+1))
		[[ $i -eq 4 ]] && i=0
		sleep 0.5;
	done
}

cat update 2>/dev/null
$(script -q -e /dev/null -c "${@} 2>&1" >/tmp/output) &
PID=$!
spinner "${PID}" &
wait ${PID}
RC=$?
sleep 0.75
printf "\r"
cat /tmp/output
exit $RC<commit_msg>Use temporary file with absolute path.<commit_after>#!/bin/bash
# Small spinner script, that returns exit code of CMD and keeps colored output
# Usage: ./spinner CMD

spinner() {
	local PID=$1
	local SPIN="/-\|"
	local i=0
	while kill -0 $PID >/dev/null 2>&1; do
		printf "\r%s" "${SPIN:$i:1}"
		i=$(($i+1))
		[[ $i -eq 4 ]] && i=0
		sleep 0.5;
	done
}

cat /tmp/update 2>/dev/null
$(script -q -e /dev/null -c "${@} 2>&1" >/tmp/output) &
PID=$!
spinner "${PID}" &
wait ${PID}
RC=$?
sleep 0.75
printf "\r"
cat /tmp/output
exit $RC
{'fraction_non_alphanumeric': 0.2188715953307393, 'fraction_numerical': 0.033073929961089495, 'mean_word_length': 3.2697095435684647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5844864', 'n_tokens_mistral': 473, 'n_tokens_neox': 430, 'n_words': 136}