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

Unified Diff: blimp/tools/client_engine_integration.py

Issue 2236143002: Add live output for blimp integration script {run} func (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: log error when engine fails to start Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/tools/client_engine_integration.py
diff --git a/blimp/tools/client_engine_integration.py b/blimp/tools/client_engine_integration.py
index f1807f38cfde71d61f3b9718402d90c1fc9b1ea4..cd0d9a15c6cdfb811b9f0306b6338e58f98fafac 100755
--- a/blimp/tools/client_engine_integration.py
+++ b/blimp/tools/client_engine_integration.py
@@ -19,7 +19,6 @@ import re
import signal
import subprocess
import sys
-import time
SRC_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..'))
@@ -102,6 +101,7 @@ def RunEngine(output_linux_directory, token_file_path):
stderr=subprocess.STDOUT)
for line in iter(p.stdout.readline, ''):
+ sys.stdout.write(line)
l = line.rstrip()
match = re.match(PORT_PATTERN, l)
if match:
@@ -173,10 +173,13 @@ def _Start(args, json_file_path, device):
args.output_linux_directory, _TOKEN_FILE_PATH)
json_object['port_number'] = port_number
json_object['pid'] = engine_process.pid
- logging.info("Engine port number: %s", port_number)
- logging.info("Engine running PID: %d", engine_process.pid)
+ logging.info('Engine port number: %s', port_number)
+ logging.info('Engine running PID: %d', engine_process.pid)
- if engine_process.poll() is None:
+ if engine_process.poll() is not None:
+ logging.error('Engine failed to start. Return code: %d',
+ engine_process.poll())
nyquist 2016/08/12 03:45:25 Is this guaranteed to return the same result acros
+ else:
try:
port_pairs = [(port_number, port_number)]
forwarder.Forwarder.Map(port_pairs, device)
@@ -200,11 +203,13 @@ def _Run(args, json_file_path, device):
try:
engine_process = _Start(args, json_file_path, device)
while True:
- time.sleep(1)
- return_code = engine_process.poll()
- if return_code is not None:
+ nextline = engine_process.stdout.readline()
+ if nextline == '' and engine_process.poll() is not None:
# The engine died.
sys.exit(1)
+ sys.stdout.write(nextline)
+ sys.stdout.flush()
+
except KeyboardInterrupt:
sys.exit(0)
finally:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698