Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _stop(self):
"""Stops the background process for logcat."""
if not self._adb_logcat_process:
return
try:
utils.stop_standing_subprocess(self._adb_logcat_process)
except:
self._ad.log.exception('Failed to stop adb logcat.')
self._adb_logcat_process = None
def stop_capture(self):
"""See base class documentation
"""
if self._process is None:
raise sniffer.InvalidOperationError(
"Trying to stop a non-started process")
utils.stop_standing_subprocess(self._process)
self._post_process()
def stop_app(self):
# Kill the pending 'adb shell am instrument -w' process if there is one.
# Although killing the snippet apk would abort this process anyway, we
# want to call stop_standing_subprocess() to perform a health check,
# print the failure stack trace if there was any, and reap it from the
# process table.
self.log.debug('Stopping snippet apk %s', self.package)
try:
# Close the socket connection.
self.disconnect()
if self._proc:
utils.stop_standing_subprocess(self._proc)
self._proc = None
out = self._adb.shell(
_STOP_CMD.format(
snippet_package=self.package,
user=self._get_user_command_string())).decode('utf-8')
if 'OK (0 tests)' not in out:
raise errors.DeviceError(
self._ad,
'Failed to stop existing apk. Unexpected output: %s' % out)
finally:
# Always clean up the adb port
self.clear_host_port()
def stop(self):
if self.started:
utils.stop_standing_subprocess(self.iperf_process)
self.started = False