-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelpers.py
45 lines (33 loc) · 1.08 KB
/
helpers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
###################################################################################################
#
# helpers.py
#
# Copyright (C) by Andreas Zoglauer & contributors
# All rights reserved.
#
# Please see the file License.txt in the main repository for the copyright-notice.
#
###################################################################################################
###################################################################################################
import os
import sys
import signal
###################################################################################################
"""
This sets a fee global variables
"""
# First take care of Ctrl-C
Interrupted = False
NInterrupts = 0
def signal_handler(signal, frame):
global Interrupted
global NInterrupts
print("You pressed Ctrl+C!")
Interrupted = True
NInterrupts += 1
if NInterrupts >= 3:
print("Aborting!")
sys.exit()
signal.signal(signal.SIGINT, signal_handler)
# END
###################################################################################################