Chromium Code Reviews| Index: tools/sharding_supervisor/stdio_buffer.py |
| diff --git a/tools/sharding_supervisor/stdio_buffer.py b/tools/sharding_supervisor/stdio_buffer.py |
| index 50184f48dc3d895b4ef9c5475073cd0ab5371d60..d16220a19812c9e7f38ee5413a53b4c23c3edfd7 100644 |
| --- a/tools/sharding_supervisor/stdio_buffer.py |
| +++ b/tools/sharding_supervisor/stdio_buffer.py |
| @@ -4,8 +4,6 @@ |
| """Syncronized Standard IO Linebuffer implemented with cStringIO.""" |
| import cStringIO |
| -import os |
| -import sys |
| import threading |
| import Queue |
| @@ -20,21 +18,21 @@ class StdioBuffer(object): |
| """Helper method for collecting stdio output. Output is collected until |
| a newline is seen, at which point an event is triggered and the line is |
| pushed to a buffer as a (stdio, line) tuple.""" |
| - buffer = cStringIO.StringIO() |
| + buf = cStringIO.StringIO() |
|
csharp
2013/01/29 01:34:18
Why buffer to buf?
|
| pipe_running = True |
| while pipe_running: |
| char = program_pipe.read(1) |
| if not char and self.shard.poll() is not None: |
| pipe_running = False |
| - buffer.write(char) |
| + buf.write(char) |
| if char == '\n' or not pipe_running: |
| - line = buffer.getvalue() |
| + line = buf.getvalue() |
| if line: |
| self.queue.put((system_pipe, line)) |
| if not pipe_running: |
| self.queue.put((system_pipe, None)) |
| - buffer.close() |
| - buffer = cStringIO.StringIO() |
| + buf.close() |
| + buf = cStringIO.StringIO() |
| def handle_pipe(self, system_pipe, program_pipe): |
| t = threading.Thread(target=self._pipe_handler, args=[system_pipe, |