diff options
author | Richard Ipsum <richardipsum@fastmail.co.uk> | 2014-12-01 17:05:44 +0000 |
---|---|---|
committer | Richard Ipsum <richardipsum@fastmail.co.uk> | 2014-12-01 17:06:18 +0000 |
commit | 3d0dcabec14ec5a1f9364ddd58d91de800eb8a02 (patch) | |
tree | 28b7279ea1999a64176022dd290cc7615de18734 | |
parent | 6d9a0e0c407ac463c9921916bb3521541743e67b (diff) | |
download | import-3d0dcabec14ec5a1f9364ddd58d91de800eb8a02.tar.gz |
hack
-rwxr-xr-x | exts/pip.find_deps | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/exts/pip.find_deps b/exts/pip.find_deps index 30ef507..cae8003 100755 --- a/exts/pip.find_deps +++ b/exts/pip.find_deps @@ -26,6 +26,7 @@ import json import tempfile import logging import select +import signal import pkg_resources import xmlrpclib @@ -253,6 +254,17 @@ def find_runtime_deps(source, name, version=None): stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) + def handler(signal, frame): + logging.debug('sigterm!') + logging.debug('terminate!') + p.terminate() + logging.debug('waiting...') + p.wait() + logging.debug('child terminated') + error('got sigterm!') + + signal.signal(signal.SIGTERM, handler) + # We close stdin on parent side to prevent the child from blocking # if it reads on stdin p.stdin.close() |