-
Notifications
You must be signed in to change notification settings - Fork 2
/
0010-Download-should-be-killable-by-KeyboardInterrupt.patch
53 lines (49 loc) · 1.72 KB
/
0010-Download-should-be-killable-by-KeyboardInterrupt.patch
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
46
47
48
49
50
51
52
From 1107856b4938452246247194495fc8009f625307 Mon Sep 17 00:00:00 2001
From: mozbugbox <mozbugbox@yahoo.com.au>
Date: Tue, 22 Mar 2016 23:06:46 +0800
Subject: [PATCH 10/10] Download should be killable by KeyboardInterrupt
---
bcloud/net.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/bcloud/net.py b/bcloud/net.py
index 6c0c222..49d28ab 100644
--- a/bcloud/net.py
+++ b/bcloud/net.py
@@ -45,6 +45,8 @@ def urloption(url, headers={}, retries=RETRIES, timeout=TIMEOUT):
except OSError:
logger.error(traceback.format_exc())
#return None
+ except KeyboardInterrupt:
+ raise
except:
logger.error(traceback.format_exc())
#return None
@@ -101,7 +103,8 @@ def urlopen(url, headers={}, data=None, retries=RETRIES, timeout=TIMEOUT):
return req
except OSError:
logger.error(traceback.format_exc())
-
+ except KeyboardInterrupt:
+ raise
except:
logger.error(traceback.format_exc())
@@ -130,6 +133,8 @@ def urlopen_without_redirect(url, headers={}, data=None, retries=RETRIES,
return conn.getresponse()
except OSError:
logger.error(traceback.format_exc())
+ except KeyboardInterrupt:
+ raise
except:
logger.error(traceback.format_exc())
#return None
@@ -160,6 +165,8 @@ def post_multipart(url, headers, fields, files, retries=RETRIES,
return req
except OSError:
logger.error(traceback.format_exc())
+ except KeyboardInterrupt:
+ raise
except:
logger.error(traceback.format_exc())
#return None
--
2.9.0