From 0346f74c1a033b4a57d4b4e856fb8d348e6e5abd Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Tue, 31 Dec 2013 12:28:29 +0100 Subject: [PATCH] [entropy.client.package] catch InterruptError raised by fetch_abort functions --- lib/entropy/client/interfaces/package/actions/fetch.py | 5 +++-- lib/entropy/client/interfaces/package/actions/multifetch.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/entropy/client/interfaces/package/actions/fetch.py b/lib/entropy/client/interfaces/package/actions/fetch.py index 0d4903d13..6befb86cb 100644 --- a/lib/entropy/client/interfaces/package/actions/fetch.py +++ b/lib/entropy/client/interfaces/package/actions/fetch.py @@ -18,6 +18,7 @@ import stat from entropy.const import etpConst, const_debug_write, const_debug_enabled, \ const_mkstemp from entropy.client.mirrors import StatusInterface +from entropy.exceptions import InterruptError from entropy.fetchers import UrlFetcher from entropy.i18n import _ from entropy.output import red, darkred, blue, purple, darkgreen, brown @@ -470,7 +471,7 @@ class _PackageFetchAction(PackageAction): delta_checksum = delta_fetcher.download() data_transfer = delta_fetcher.get_transfer_rate() del delta_fetcher - except KeyboardInterrupt: + except (KeyboardInterrupt, InterruptError): return -100, data_transfer except NameError: @@ -569,7 +570,7 @@ class _PackageFetchAction(PackageAction): fetch_checksum = fetch_intf.download() data_transfer = fetch_intf.get_transfer_rate() resumed = fetch_intf.is_resumed() - except KeyboardInterrupt: + except (KeyboardInterrupt, InterruptError): return -100, data_transfer, resumed except NameError: diff --git a/lib/entropy/client/interfaces/package/actions/multifetch.py b/lib/entropy/client/interfaces/package/actions/multifetch.py index f46ada9f1..aeed05572 100644 --- a/lib/entropy/client/interfaces/package/actions/multifetch.py +++ b/lib/entropy/client/interfaces/package/actions/multifetch.py @@ -16,6 +16,7 @@ import threading from entropy.const import etpConst, const_setup_perms, const_mkstemp from entropy.client.mirrors import StatusInterface +from entropy.exceptions import InterruptError from entropy.fetchers import UrlFetcher from entropy.output import blue, darkblue, bold, red, darkred, brown, darkgreen from entropy.i18n import _, ngettext @@ -301,7 +302,7 @@ class _PackageMultiFetchAction(_PackageFetchAction): fetch_abort_function() data = fetch_intf.download() - except KeyboardInterrupt: + except (KeyboardInterrupt, InterruptError): return [], 0.0, -100 data_transfer = fetch_intf.get_transfer_rate() @@ -481,7 +482,7 @@ class _PackageMultiFetchAction(_PackageFetchAction): fetch_abort_function() data = fetch_intf.download() - except KeyboardInterrupt: + except (KeyboardInterrupt, InterruptError): return -100, {}, 0 failed_map = {}