Skip to content

Commit

Permalink
fix index error
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyLothar committed Apr 9, 2015
1 parent df6d39b commit 6f7429e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions shcmd/proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def iter_lines(self):
"""yields stdout text, line by line."""
remain = ""
for data in self.iter_content(LINE_CHUNK_SIZE):
print(repr(data).center(50, "x"))
line_break_found = data[-1] in (b"\n", b"\r")
lines = data.decode(self.codec).splitlines()
lines[0] = remain + lines[0]
Expand Down Expand Up @@ -173,7 +172,8 @@ def iter_content(self, chunk_size=1):
with self._stream() as proc:
while proc.poll() is None:
chunk = proc.stdout.read(chunk_size)
print("chunk is {0}".format(repr(chunk)))
if not chunk:
continue
yield chunk
data += chunk

Expand All @@ -185,7 +185,6 @@ def iter_content(self, chunk_size=1):
chunk = proc.stdout.read(chunk_size)
while chunk:
yield chunk
print("end block chunk is {0}".format(repr(chunk)))
data += chunk
chunk = proc.stdout.read(chunk_size)

Expand Down

0 comments on commit 6f7429e

Please sign in to comment.