[PATCH 2/2] downloadonly: unlink .tmp files on ctrl-c. BZ 1045806

Zdenek Pavlas zpavlas at redhat.com
Tue Jan 21 14:25:26 UTC 2014


On ctrl-c we don't call failfunc neither we wait
for delta rebuilds to finish. Have to clean up..
---
 yum/__init__.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 5d55658..8fb161c 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2478,7 +2478,15 @@ much more problems).
                 except Errors.RepoError, e:
                     adderror(po, exception2msg(e))
             if async:
-                urlgrabber.grabber.parallel_wait()
+                try:
+                    urlgrabber.grabber.parallel_wait()
+                except KeyboardInterrupt:
+                    for po in remote_pkgs:
+                        if po.localpath.endswith('.tmp'):
+                            misc.unlink_f(po.localpath)
+                        elif isinstance(po, DeltaPackage) and po.rpm.localpath.endswith('.tmp'):
+                            misc.unlink_f(po.rpm.localpath)
+                    raise
             presto.dequeue_all()
             presto.wait()
 
-- 
1.7.11.7



More information about the Yum-devel mailing list