OLD | NEW |
1 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 def run(self, command, ignore_error=False): | 250 def run(self, command, ignore_error=False): |
251 self._log_debug('Run adb command: ' + str(command)) | 251 self._log_debug('Run adb command: ' + str(command)) |
252 if ignore_error: | 252 if ignore_error: |
253 error_handler = self._executive.ignore_error | 253 error_handler = self._executive.ignore_error |
254 else: | 254 else: |
255 error_handler = None | 255 error_handler = None |
256 | 256 |
257 result = self._executive.run_command(self.adb_command() + command, error
_handler=error_handler, debug_logging=self._debug_logging) | 257 result = self._executive.run_command(self.adb_command() + command, error
_handler=error_handler, debug_logging=self._debug_logging) |
258 | 258 |
259 # We limit the length to avoid outputting too verbose commands, such as
"adb logcat". | 259 # We limit the length to avoid outputting too verbose commands, such as
"adb logcat". |
260 # Also make sure that the output is ascii-encoded to avoid confusing oth
er parts of | 260 self._log_debug('Run adb result: ' + result[:80]) |
261 # the system. | |
262 self._log_debug('Run adb result: ' + result[:80].encode('ascii', errors=
'replace')) | |
263 return result | 261 return result |
264 | 262 |
265 def get_serial(self): | 263 def get_serial(self): |
266 return self._device_serial | 264 return self._device_serial |
267 | 265 |
268 def adb_command(self): | 266 def adb_command(self): |
269 return [AndroidCommands.adb_command_path(self._executive, self._debug_lo
gging), '-s', self._device_serial] | 267 return [AndroidCommands.adb_command_path(self._executive, self._debug_lo
gging), '-s', self._device_serial] |
270 | 268 |
271 @staticmethod | 269 @staticmethod |
272 def set_adb_command_path_options(paths): | 270 def set_adb_command_path_options(paths): |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 return command | 1268 return command |
1271 | 1269 |
1272 def _read_prompt(self, deadline): | 1270 def _read_prompt(self, deadline): |
1273 last_char = '' | 1271 last_char = '' |
1274 while True: | 1272 while True: |
1275 current_char = self._server_process.read_stdout(deadline, 1) | 1273 current_char = self._server_process.read_stdout(deadline, 1) |
1276 if current_char == ' ': | 1274 if current_char == ' ': |
1277 if last_char in ('#', '$'): | 1275 if last_char in ('#', '$'): |
1278 return | 1276 return |
1279 last_char = current_char | 1277 last_char = current_char |
OLD | NEW |