mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 16:11:15 +00:00
Cleanup progress bar if there's an exception, too
This commit is contained in:
parent
ca2abaa613
commit
bf0709edf6
@ -326,6 +326,7 @@ class SourcePackage(object):
|
|||||||
|
|
||||||
downloaded = 0
|
downloaded = 0
|
||||||
bar_width = 60
|
bar_width = 60
|
||||||
|
try:
|
||||||
with open(pathname, 'wb') as out:
|
with open(pathname, 'wb') as out:
|
||||||
while True:
|
while True:
|
||||||
block = in_.read(10240)
|
block = in_.read(10240)
|
||||||
@ -340,6 +341,7 @@ class SourcePackage(object):
|
|||||||
Logger.stdout.write('[%s] %#3i%%\r' % (bar, percent))
|
Logger.stdout.write('[%s] %#3i%%\r' % (bar, percent))
|
||||||
Logger.stdout.flush()
|
Logger.stdout.flush()
|
||||||
in_.close()
|
in_.close()
|
||||||
|
finally:
|
||||||
if not self.quiet:
|
if not self.quiet:
|
||||||
Logger.stdout.write(' ' * (bar_width + 7) + '\r')
|
Logger.stdout.write(' ' * (bar_width + 7) + '\r')
|
||||||
Logger.stdout.flush()
|
Logger.stdout.flush()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user