summaryrefslogtreecommitdiff
path: root/lib/python/qmk/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/util.py')
-rw-r--r--lib/python/qmk/util.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/python/qmk/util.py b/lib/python/qmk/util.py
index db7debd578..0145ab1354 100644
--- a/lib/python/qmk/util.py
+++ b/lib/python/qmk/util.py
@@ -2,9 +2,30 @@
2""" 2"""
3import contextlib 3import contextlib
4import multiprocessing 4import multiprocessing
5import sys
5 6
6from milc import cli 7from milc import cli
7 8
9maybe_exit_should_exit = True
10maybe_exit_reraise = False
11
12
13# Controls whether or not early `exit()` calls should be made
14def maybe_exit(rc):
15 if maybe_exit_should_exit:
16 sys.exit(rc)
17 if maybe_exit_reraise:
18 e = sys.exception()
19 if e:
20 raise e
21
22
23def maybe_exit_config(should_exit: bool = True, should_reraise: bool = False):
24 global maybe_exit_should_exit
25 global maybe_exit_reraise
26 maybe_exit_should_exit = should_exit
27 maybe_exit_reraise = should_reraise
28
8 29
9@contextlib.contextmanager 30@contextlib.contextmanager
10def parallelize(): 31def parallelize():