Clean up division by zero fix

This commit is contained in:
Yang Zhang 2013-08-23 14:04:09 -07:00
parent f2c37cae26
commit 37104d7b78

View File

@ -112,7 +112,7 @@ def run(verbosity=1, test=False):
new_mtime = int(st.st_mtime)
current_size += st.st_size
if verbosity:
size_fmt = '\r{:>6.1%}'.format(current_size/total_size if total_size > 0 else 0)
size_fmt = '\r{:>6.1%}'.format(current_size/(total_size or 1))
if size_fmt != last_reported_size:
sys.stdout.write(size_fmt)
sys.stdout.flush()