From 075a8d3f3cd4f03abe102e44ba683199ce428e3e Mon Sep 17 00:00:00 2001 From: Pbatch <37177749+Pbatch@users.noreply.github.com> Date: Thu, 4 Jul 2024 01:39:32 +0100 Subject: [PATCH] Add command to restart ADB server (#199) --- clashroyalebuildabot/emulator/emulator.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clashroyalebuildabot/emulator/emulator.py b/clashroyalebuildabot/emulator/emulator.py index 683b5ea..69b68cd 100644 --- a/clashroyalebuildabot/emulator/emulator.py +++ b/clashroyalebuildabot/emulator/emulator.py @@ -113,6 +113,7 @@ def __init__(self): self.forward_port = get_free_port() self._install_adb() + self._restart_server() self.width, self.height = self._get_width_and_height() self._copy_scrcpy() self._forward_port() @@ -201,6 +202,14 @@ def _run_command(self, command): return result.stdout + def _restart_server(self): + self._run_command( + [ + "kill-server", + ] + ) + self._run_command(["start-server"]) + def _copy_scrcpy(self): self._run_command(["push", "scrcpy-server.jar", "/data/local/tmp/"])