summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-01 16:10:38 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-01 16:10:38 +0000
commitb98a46c952944a6d0d961c7af0b2815999c3ca3a (patch)
tree1651262c3f3ce562baec3eb2cf1da8f33affe0cc
parentf491083870a5d8aad426f8d0b9b52e832e13788d (diff)
downloadimport-b98a46c952944a6d0d961c7af0b2815999c3ca3a.tar.gz
catch interrupt
-rwxr-xr-xexts/pip.find_deps15
1 files changed, 10 insertions, 5 deletions
diff --git a/exts/pip.find_deps b/exts/pip.find_deps
index 30ef507..cb51ccb 100755
--- a/exts/pip.find_deps
+++ b/exts/pip.find_deps
@@ -257,14 +257,19 @@ def find_runtime_deps(source, name, version=None):
# if it reads on stdin
p.stdin.close()
- while True:
- line = p.stdout.readline()
- if line == '':
- break
+ try:
+ while True:
+ line = p.stdout.readline()
+ if line == '':
+ break
+
+ p.wait() # even with eof on both streams, we still wait
+ except KeyboardInterrupt:
+ logging.debug('exception! (KeyboardInterrupt)')
+ p.terminate() # send SIGTERM to child
logging.debug(line.rstrip())
- p.wait() # even with eof on both streams, we still wait
logging.debug('pip exited with code: %d' % p.returncode)