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 # pylint: disable=W0212 | 5 # pylint: disable=W0212 |
6 | 6 |
7 import fcntl | 7 import fcntl |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import psutil | 10 import psutil |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 """ | 282 """ |
283 device_serial = str(device) | 283 device_serial = str(device) |
284 if device_serial in self._initialized_devices: | 284 if device_serial in self._initialized_devices: |
285 return | 285 return |
286 Forwarder._KillDeviceLocked(device, tool) | 286 Forwarder._KillDeviceLocked(device, tool) |
287 device.PushChangedFiles([( | 287 device.PushChangedFiles([( |
288 self._device_forwarder_path_on_host, | 288 self._device_forwarder_path_on_host, |
289 Forwarder._DEVICE_FORWARDER_FOLDER)]) | 289 Forwarder._DEVICE_FORWARDER_FOLDER)]) |
290 cmd = '%s %s' % (tool.GetUtilWrapper(), Forwarder._DEVICE_FORWARDER_PATH) | 290 cmd = '%s %s' % (tool.GetUtilWrapper(), Forwarder._DEVICE_FORWARDER_PATH) |
291 device.RunShellCommand( | 291 device.RunShellCommand( |
292 cmd, env={'LD_LIBRARY_PATH': Forwarder._DEVICE_FORWARDER_FOLDER}) | 292 cmd, env={'LD_LIBRARY_PATH': Forwarder._DEVICE_FORWARDER_FOLDER}, |
| 293 check_return=True) |
293 self._initialized_devices.add(device_serial) | 294 self._initialized_devices.add(device_serial) |
294 | 295 |
295 def _KillHostLocked(self): | 296 def _KillHostLocked(self): |
296 """Kills the forwarder process running on the host. | 297 """Kills the forwarder process running on the host. |
297 | 298 |
298 Note that the global lock must be acquired before calling this method. | 299 Note that the global lock must be acquired before calling this method. |
299 """ | 300 """ |
300 logging.info('Killing host_forwarder.') | 301 logging.info('Killing host_forwarder.') |
301 (exit_code, output) = cmd_helper.GetCmdStatusAndOutput( | 302 (exit_code, output) = cmd_helper.GetCmdStatusAndOutput( |
302 [self._host_forwarder_path, '--kill-server']) | 303 [self._host_forwarder_path, '--kill-server']) |
(...skipping 16 matching lines...) Expand all Loading... |
319 forwarder (see valgrind_tools.py). | 320 forwarder (see valgrind_tools.py). |
320 """ | 321 """ |
321 logging.info('Killing device_forwarder.') | 322 logging.info('Killing device_forwarder.') |
322 Forwarder._instance._initialized_devices.discard(str(device)) | 323 Forwarder._instance._initialized_devices.discard(str(device)) |
323 if not device.FileExists(Forwarder._DEVICE_FORWARDER_PATH): | 324 if not device.FileExists(Forwarder._DEVICE_FORWARDER_PATH): |
324 return | 325 return |
325 | 326 |
326 cmd = '%s %s --kill-server' % (tool.GetUtilWrapper(), | 327 cmd = '%s %s --kill-server' % (tool.GetUtilWrapper(), |
327 Forwarder._DEVICE_FORWARDER_PATH) | 328 Forwarder._DEVICE_FORWARDER_PATH) |
328 device.RunShellCommand( | 329 device.RunShellCommand( |
329 cmd, env={'LD_LIBRARY_PATH': Forwarder._DEVICE_FORWARDER_FOLDER}) | 330 cmd, env={'LD_LIBRARY_PATH': Forwarder._DEVICE_FORWARDER_FOLDER}, |
| 331 check_return=True) |
OLD | NEW |