| OLD | NEW |
| 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 # pylint: skip-file | 9 # pylint: skip-file |
| 10 | 10 |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 # whether a wrapper for running PIE executable is needed (only Android ICS) | 687 # whether a wrapper for running PIE executable is needed (only Android ICS) |
| 688 # or not. The results is cached, so the wrapper is pushed only once. | 688 # or not. The results is cached, so the wrapper is pushed only once. |
| 689 if self._pie_wrapper is None: | 689 if self._pie_wrapper is None: |
| 690 # None: did not check; '': did check and not needed; '/path': use /path. | 690 # None: did not check; '': did check and not needed; '/path': use /path. |
| 691 self._pie_wrapper = '' | 691 self._pie_wrapper = '' |
| 692 if self.GetBuildId().startswith('I'): # Ixxxx = Android ICS. | 692 if self.GetBuildId().startswith('I'): # Ixxxx = Android ICS. |
| 693 run_pie_dist_path = os.path.join(constants.GetOutDirectory(), 'run_pie') | 693 run_pie_dist_path = os.path.join(constants.GetOutDirectory(), 'run_pie') |
| 694 assert os.path.exists(run_pie_dist_path), 'Please build run_pie' | 694 assert os.path.exists(run_pie_dist_path), 'Please build run_pie' |
| 695 # The PIE loader must be pushed manually (i.e. no PushIfNeeded) because | 695 # The PIE loader must be pushed manually (i.e. no PushIfNeeded) because |
| 696 # PushIfNeeded requires md5sum and md5sum requires the wrapper as well. | 696 # PushIfNeeded requires md5sum and md5sum requires the wrapper as well. |
| 697 command = 'push %s %s' % (run_pie_dist_path, PIE_WRAPPER_PATH) | 697 adb_command = 'push %s %s' % (run_pie_dist_path, PIE_WRAPPER_PATH) |
| 698 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) | 698 assert _HasAdbPushSucceeded(self._adb.SendCommand(adb_command)) |
| 699 self._pie_wrapper = PIE_WRAPPER_PATH | 699 self._pie_wrapper = PIE_WRAPPER_PATH |
| 700 | 700 |
| 701 if self._pie_wrapper: | 701 if self._pie_wrapper: |
| 702 command = '%s %s' % (self._pie_wrapper, command) | 702 command = '%s %s' % (self._pie_wrapper, command) |
| 703 if lib_path: | 703 if lib_path: |
| 704 command = 'LD_LIBRARY_PATH=%s %s' % (lib_path, command) | 704 command = 'LD_LIBRARY_PATH=%s %s' % (lib_path, command) |
| 705 return self.GetShellCommandStatusAndOutput(command, *args, **kw) | 705 return self.GetShellCommandStatusAndOutput(command, *args, **kw) |
| 706 | 706 |
| 707 # It is tempting to turn this function into a generator, however this is not | 707 # It is tempting to turn this function into a generator, however this is not |
| 708 # possible without using a private (local) adb_shell instance (to ensure no | 708 # possible without using a private (local) adb_shell instance (to ensure no |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 """ | 1963 """ |
| 1964 def __init__(self, output): | 1964 def __init__(self, output): |
| 1965 self._output = output | 1965 self._output = output |
| 1966 | 1966 |
| 1967 def write(self, data): | 1967 def write(self, data): |
| 1968 data = data.replace('\r\r\n', '\n') | 1968 data = data.replace('\r\r\n', '\n') |
| 1969 self._output.write(data) | 1969 self._output.write(data) |
| 1970 | 1970 |
| 1971 def flush(self): | 1971 def flush(self): |
| 1972 self._output.flush() | 1972 self._output.flush() |
| OLD | NEW |