Move status counter to stderr

This continues work in I09f352b41527c563a158fdcdbb1b7d5bc878c0da to move
the status counter from stdout to stderr, so it does not disrupt Bandit
output piped to a file.

Change-Id: Ib7268a50ecb1c90ebd834937edbf20390d80d556
Implements: blueprint log-to-stderr
This commit is contained in:
Jamie Finnigan 2015-12-14 08:25:50 -08:00
parent 8bd3c567a8
commit 092e871074
1 changed files with 5 additions and 5 deletions

View File

@ -248,7 +248,7 @@ class BanditManager():
'''
# display progress, if number of files warrants it
if len(self.files_list) > self.progress:
sys.stdout.write("%s [" % len(self.files_list))
sys.stderr.write("%s [" % len(self.files_list))
# if we have problems with a file, we'll remove it from the files_list
# and add it to the skipped list instead
@ -260,8 +260,8 @@ class BanditManager():
if len(self.files_list) > self.progress:
# is it time to update the progress indicator?
if count % self.progress == 0:
sys.stdout.write("%s.. " % count)
sys.stdout.flush()
sys.stderr.write("%s.. " % count)
sys.stderr.flush()
try:
with open(fname, 'rU') as fdata:
try:
@ -283,8 +283,8 @@ class BanditManager():
new_files_list.remove(fname)
if len(self.files_list) > self.progress:
sys.stdout.write("]\n")
sys.stdout.flush()
sys.stderr.write("]\n")
sys.stderr.flush()
# reflect any files which may have been skipped
self.files_list = new_files_list