run-tests: don't disable linewrapping if there is nothing to output

Summary:
The tests for run-tests expect there to be no linewrapping control characters
output when there are no progress lines to print.  Make sure they only get
printed if there are lines to print.

Reviewed By: DurhamG

Differential Revision: D14851271

fbshipit-source-id: 4004f848e2e205d36bd0dd107ced2fe9d69e31d8
This commit is contained in:
Mark Thomas 2019-04-09 13:29:02 -07:00 committed by Facebook Github Bot
parent 0af9f95998
commit 0cc0028d21

View File

@ -2160,10 +2160,11 @@ class Progress(object):
moveup -= toclear
if moveup > 0:
content += "\033[%dA" % moveup
# Disable line wrapping while outputing the progress entries
content += "\x1b[?7l"
content += "\n".join("\r\033[K%s" % line.rstrip() for line in lines)
content += "\x1b[?7h"
if lines:
# Disable line wrapping while outputing the progress entries
content += "\x1b[?7l"
content += "\n".join("\r\033[K%s" % line.rstrip() for line in lines)
content += "\x1b[?7h"
self._write(content)
self.lines = lines