Commit e580d202 authored by Chris Lamb's avatar Chris Lamb

Ensure 4-line indentation.

parent e813b51c
......@@ -26,7 +26,6 @@ logger = logging.getLogger(__name__)
class Command(object, metaclass=abc.ABCMeta):
MAX_STDERR_LINES = 50
def __init__(self, path):
......@@ -49,7 +48,6 @@ class Command(object, metaclass=abc.ABCMeta):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
self.stderr = self._read_stderr()
@property
......@@ -82,14 +80,16 @@ class Command(object, metaclass=abc.ABCMeta):
def _read_stderr(self):
buf = ""
lines = self._process.stderr.splitlines(True)
for index, line in enumerate(lines):
if index >= Command.MAX_STDERR_LINES:
break
buf += line.decode('utf-8', errors='replace')
if index >= Command.MAX_STDERR_LINES:
break
buf += line.decode('utf-8', errors='replace')
if len(lines) > Command.MAX_STDERR_LINES:
buf += '[ {} lines ignored ]\n'.format(
len(lines) - Command.MAX_STDERR_LINES)
buf += '[ {} lines ignored ]\n'.format(
len(lines) - Command.MAX_STDERR_LINES,
)
return buf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment