Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: tools/sharding_supervisor/stdio_buffer.py

Issue 12079037: Add PRESUBMIT.py to tools/sharding_supervisor/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698