add signal handler

This commit is contained in:
Maximilian Keßler 2022-02-17 21:31:15 +01:00
parent 09bfa89dfe
commit b0077a3ee9

14
main.py
View file

@ -1,8 +1,21 @@
import signal
import shutil
from pathlib import Path
from PyTeX.build.build import PyTeXBuilder
from PyTeX.build.build.pytex_config import PyTeXConfig
from PyTeX.format.formatting_config import FormattingConfig
def interrupt_handler(signum, frame):
if Path('.pytex').exists():
shutil.rmtree('.pytex')
print('Interrupted execution')
quit(1)
signal.signal(signal.SIGINT, interrupt_handler)
conf_path = Path('.pytexrc')
builder = PyTeXBuilder(conf_path)
@ -10,5 +23,4 @@ builder = PyTeXBuilder(conf_path)
builder.build_tex_sources()
pass