async def run_with_companion(self, args: Namespace, companion: Companion) -> None: if args.headless: async with companion.boot_headless(udid=self.get_udid(args)): await signal_handler_event("headless_boot").wait() else: await companion.boot(udid=self.get_udid(args))
async def for_companion( cls, companion: Companion, udid: str, logger: logging.Logger, only: Optional[OnlyFilter] = None, ) -> AsyncGenerator["Client", None]: with tempfile.NamedTemporaryFile() as temp: # Remove the tempfile so we can bind to it first. os.remove(temp.name) async with companion.unix_domain_server( udid=udid, path=temp.name, only=only) as resolved_path, Client.build( address=DomainSocketAddress(path=resolved_path), is_local=True, logger=logger, ) as client: yield client