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

Side by Side Diff: build/android/pylib/android_commands.py

Issue 11360248: Use the new forwarder2's Daemon implementation in device_forwarder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Marcus' comments Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/pylib/forwarder.py » ('j') | tools/android/forwarder2/daemon.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Provides an interface to communicate with the device via the adb command. 5 """Provides an interface to communicate with the device via the adb command.
6 6
7 Assumes adb binary is currently on system path. 7 Assumes adb binary is currently on system path.
8 """ 8 """
9 9
10 import collections 10 import collections
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 logging.info('>>> $' + command) 459 logging.info('>>> $' + command)
460 if "'" in command: logging.warning(command + " contains ' quotes") 460 if "'" in command: logging.warning(command + " contains ' quotes")
461 result = self._adb.SendShellCommand( 461 result = self._adb.SendShellCommand(
462 "'%s'" % command, timeout_time).splitlines() 462 "'%s'" % command, timeout_time).splitlines()
463 if ['error: device not found'] == result: 463 if ['error: device not found'] == result:
464 raise errors.DeviceUnresponsiveError('device not found') 464 raise errors.DeviceUnresponsiveError('device not found')
465 if log_result: 465 if log_result:
466 logging.info('\n>>> '.join(result)) 466 logging.info('\n>>> '.join(result))
467 return result 467 return result
468 468
469 def GetShellCommandStatusAndOutput(self, command, timeout_time=20,
470 log_result=False):
471 """See RunShellCommand() above.
472
473 Returns:
474 The tuple (exit code, list of output lines).
475 """
476 lines = self.RunShellCommand(
477 command + '; echo $?', timeout_time, log_result)
digit1 2012/11/19 15:27:43 Nit: This assumes that the command's output will b
Philippe 2012/11/19 17:18:59 Good point.
478 return (int(lines[-1]), lines[:-1])
479
469 def KillAll(self, process): 480 def KillAll(self, process):
470 """Android version of killall, connected via adb. 481 """Android version of killall, connected via adb.
471 482
472 Args: 483 Args:
473 process: name of the process to kill off 484 process: name of the process to kill off
474 485
475 Returns: 486 Returns:
476 the number of processes killed 487 the number of processes killed
477 """ 488 """
478 pids = self.ExtractPid(process) 489 pids = self.ExtractPid(process)
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 """ 1103 """
1093 def __init__(self, output): 1104 def __init__(self, output):
1094 self._output = output 1105 self._output = output
1095 1106
1096 def write(self, data): 1107 def write(self, data):
1097 data = data.replace('\r\r\n', '\n') 1108 data = data.replace('\r\r\n', '\n')
1098 self._output.write(data) 1109 self._output.write(data)
1099 1110
1100 def flush(self): 1111 def flush(self):
1101 self._output.flush() 1112 self._output.flush()
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/forwarder.py » ('j') | tools/android/forwarder2/daemon.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698