How to use the mobly.utils.stop_standing_subprocess function in mobly

To help you get started, we’ve selected a few mobly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / mobly / mobly / controllers / android_device_lib / services / logcat.py View on Github external
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
github google / mobly / mobly / controllers / sniffer_lib / local / local_base.py View on Github external
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()
github google / mobly / mobly / controllers / android_device_lib / snippet_client.py View on Github external
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()
github google / mobly / mobly / controllers / iperf_server.py View on Github external
def stop(self):
        if self.started:
            utils.stop_standing_subprocess(self.iperf_process)
            self.started = False