diff options
author | Bradley Sepos <[email protected]> | 2016-05-24 18:44:12 -0400 |
---|---|---|
committer | Bradley Sepos <[email protected]> | 2016-05-25 15:45:05 -0400 |
commit | 8507acecae257bf42019a0fa2662d71277bcc6ce (patch) | |
tree | b17096260e9a2ea9e96a9d8bd13ccdf246a0795a /make | |
parent | 3bf86382ab351ac0db02dcef41ed27502ff4fb41 (diff) |
build: Add basic termination signal handling to df-*.py.
Diffstat (limited to 'make')
-rw-r--r-- | make/df-fetch.py | 10 | ||||
-rw-r--r-- | make/df-verify.py | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/make/df-fetch.py b/make/df-fetch.py index 882e105c7..93b639cd0 100644 --- a/make/df-fetch.py +++ b/make/df-fetch.py @@ -13,6 +13,7 @@ import hashlib import random import re import os +import signal import sys import time import urllib2 @@ -23,6 +24,15 @@ import hb_distfile ############################################################################### +def signal_handler(signal, frame): + sys.stderr.write('^C') + sys.exit(1) + +signal.signal(signal.SIGINT, signal_handler) +signal.signal(signal.SIGTERM, signal_handler) + +############################################################################### + ## simple structure object class Struct(object): pass diff --git a/make/df-verify.py b/make/df-verify.py index a06829e56..51cbf5bdb 100644 --- a/make/df-verify.py +++ b/make/df-verify.py @@ -10,6 +10,7 @@ import hashlib import os +import signal import sys sys.dont_write_bytecode = True @@ -18,6 +19,15 @@ import hb_distfile ############################################################################### +def signal_handler(signal, frame): + sys.stderr.write('^C') + sys.exit(1) + +signal.signal(signal.SIGINT, signal_handler) +signal.signal(signal.SIGTERM, signal_handler) + +############################################################################### + ## simple structure object class Struct(object): pass |