add signal handler
This commit is contained in:
parent
09bfa89dfe
commit
b0077a3ee9
1 changed files with 13 additions and 1 deletions
14
main.py
14
main.py
|
@ -1,8 +1,21 @@
|
||||||
|
import signal
|
||||||
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PyTeX.build.build import PyTeXBuilder
|
from PyTeX.build.build import PyTeXBuilder
|
||||||
from PyTeX.build.build.pytex_config import PyTeXConfig
|
from PyTeX.build.build.pytex_config import PyTeXConfig
|
||||||
from PyTeX.format.formatting_config import FormattingConfig
|
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')
|
conf_path = Path('.pytexrc')
|
||||||
|
|
||||||
builder = PyTeXBuilder(conf_path)
|
builder = PyTeXBuilder(conf_path)
|
||||||
|
@ -10,5 +23,4 @@ builder = PyTeXBuilder(conf_path)
|
||||||
builder.build_tex_sources()
|
builder.build_tex_sources()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue