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 self._log_debug('Run adb result: ' + result[:80]) | 260 # Also make sure that the output is ascii-encoded to avoid confusing oth
er parts of |
| 261 # the system. |
| 262 self._log_debug('Run adb result: ' + result[:80].encode('ascii', errors=
'replace')) |
261 return result | 263 return result |
262 | 264 |
263 def get_serial(self): | 265 def get_serial(self): |
264 return self._device_serial | 266 return self._device_serial |
265 | 267 |
266 def adb_command(self): | 268 def adb_command(self): |
267 return [AndroidCommands.adb_command_path(self._executive, self._debug_lo
gging), '-s', self._device_serial] | 269 return [AndroidCommands.adb_command_path(self._executive, self._debug_lo
gging), '-s', self._device_serial] |
268 | 270 |
269 @staticmethod | 271 @staticmethod |
270 def set_adb_command_path_options(paths): | 272 def set_adb_command_path_options(paths): |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 return command | 1270 return command |
1269 | 1271 |
1270 def _read_prompt(self, deadline): | 1272 def _read_prompt(self, deadline): |
1271 last_char = '' | 1273 last_char = '' |
1272 while True: | 1274 while True: |
1273 current_char = self._server_process.read_stdout(deadline, 1) | 1275 current_char = self._server_process.read_stdout(deadline, 1) |
1274 if current_char == ' ': | 1276 if current_char == ' ': |
1275 if last_char in ('#', '$'): | 1277 if last_char in ('#', '$'): |
1276 return | 1278 return |
1277 last_char = current_char | 1279 last_char = current_char |
OLD | NEW |