Fix extra new line that break from progress bar

The new line should be writed to stdout only when there is
a progress bar displayed.

Change-Id: If0e62cd5a3734ed67d66d285267c101b7caeea77
Closes-Bug: #1253042
This commit is contained in:
m.benchchaoui@cloudbau.de
2013-11-20 11:44:40 +01:00
parent c22b88d9b1
commit 2dfbb3f57b
3 changed files with 35 additions and 8 deletions
+8 -4
View File
@@ -58,8 +58,10 @@ class VerboseFileWrapper(_ProgressBarBase):
if data:
self._display_progress_bar(len(data))
else:
# Break to a new line from the progress bar for incoming output.
sys.stdout.write('\n')
if self._show_progress:
# Break to a new line from the progress bar for incoming
# output.
sys.stdout.write('\n')
return data
@@ -82,6 +84,8 @@ class VerboseIteratorWrapper(_ProgressBarBase):
self._display_progress_bar(len(data))
return data
except StopIteration:
# Break to a new line from the progress bar for incoming output.
sys.stdout.write('\n')
if self._show_progress:
# Break to a new line from the progress bar for incoming
# output.
sys.stdout.write('\n')
raise