2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-12 16:49:42 +00:00

Fix nodersync with output redirection

Variables were left unitialized, use them only
in the tty path.
This commit is contained in:
Jarrod Johnson 2021-11-15 09:20:31 -05:00
parent d5e4d1b90a
commit 55fc3bda51

View File

@ -60,12 +60,12 @@ class ScreenPrinter(object):
fieldformat = '{{0:>{0}}}:{{1:{1}}}'.format(self.nodenamelen,
self.textlen)
sys.stdout.write('\x1b[2J\x1b[;H') # clear screen
if len(self.nodelist) < (numfields * currheight):
numfields = len(self.nodelist) // currheight + 1
else:
numfields = 1
fieldformat = '{0}: {1}'
currfields = 0
if len(self.nodelist) < (numfields * currheight):
numfields = len(self.nodelist) // currheight + 1
for node in self.nodelist:
if currfields >= numfields:
sys.stdout.write('\n')