summaryrefslogtreecommitdiffstats
path: root/dimension
diff options
context:
space:
mode:
Diffstat (limited to 'dimension')
-rw-r--r--dimension/dimension.in30
1 files changed, 21 insertions, 9 deletions
diff --git a/dimension/dimension.in b/dimension/dimension.in
index 01dc2f3..f0db4fc 100644
--- a/dimension/dimension.in
+++ b/dimension/dimension.in
@@ -111,21 +111,33 @@ from dimension import *
# Display a progress bar
def _progress_bar(str, progress):
- if not _args.quiet:
- print(str, end = ' ')
- _sys.stdout.flush()
+ try:
+ if not _args.quiet:
+ print(str, end = ' ')
+ _sys.stdout.flush()
+
+ term_width = terminal_width()
+ width = term_width - (len(str) + 1)%term_width
+ for i in range(width):
+ progress.wait((i + 1)/width)
+ print('.', end = '')
+ _sys.stdout.flush()
- term_width = terminal_width()
- width = term_width - (len(str) + 1)%term_width
- for i in range(width):
- progress.wait((i + 1)/width)
- print('.', end = '')
+ print()
_sys.stdout.flush()
+ progress.finish()
+ except KeyboardInterrupt:
print()
_sys.stdout.flush()
- progress.finish()
+ progress.cancel()
+ try:
+ progress.finish()
+ except:
+ # Swallow the failure exception
+ pass
+ raise
# --strict option
die_on_warnings(_args.strict)