#!/bin/sh

cleanup () {
	rm -f *.log *.aux *.toc
	exit $1
}

trap cleanup HUP TERM INT

SRC=esorics2022.tex

echo -ne "\e[;1H\e[2J"
while true; do
	tectonic $SRC || echo 
	FILES=$(echo *.tex)
	while inotifywait $FILES ; do
		echo -ne "\e[;1H\e[2J"
		tectonic $SRC || echo 
	done
done
