From a856bf67f37826de6594161e44a6547425686814 Mon Sep 17 00:00:00 2001 From: bozowski Date: Fri, 20 Oct 2023 15:04:32 -0700 Subject: [PATCH] Fix pull --- .../platform/android/streams/screen/screen.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/tools/interop/idt/capture/platform/android/streams/screen/screen.py b/src/tools/interop/idt/capture/platform/android/streams/screen/screen.py index b696493f1f278c..058835ea243c8d 100644 --- a/src/tools/interop/idt/capture/platform/android/streams/screen/screen.py +++ b/src/tools/interop/idt/capture/platform/android/streams/screen/screen.py @@ -44,6 +44,7 @@ def __init__(self, platform: "Android"): self.screen_pull = False self.file_counter = 0 self.pull_commands: [str] = [] + self.manifest_file = os.path.join(platform.artifact_dir, "screen_manifest.txt") def check_screen(self) -> bool: screen_cmd_output = self.platform.run_adb_command( @@ -70,9 +71,10 @@ def update_commands(self) -> None: parent=self.platform.artifact_dir) self.screen_phone_out_path = f"/sdcard/Movies/{os.path.basename(self.screen_artifact)}" self.screen_command = f"shell screenrecord --bugreport {self.screen_phone_out_path}" - screen_pull_command = f"pull {self.screen_phone_out_path} {self.screen_artifact}" + screen_pull_command = f"pull {self.screen_phone_out_path} {self.screen_artifact}\n" self.pull_commands.append(screen_pull_command) - # Need to write these to a file instead, to be shared between processes + with open(self.manifest_file, "a+") as manifest: + manifest.write(screen_pull_command) self.file_counter += 1 def run_recorder(self) -> None: @@ -90,11 +92,12 @@ async def start(self): async def pull_screen_recording(self) -> None: if self.screen_pull: - for command in self.pull_commands: - self.logger.info("Attempting to pull screen recording") - await asyncio.sleep(3) - self.platform.run_adb_command(command) - self.screen_pull = False + self.logger.info("Attempting to pull screen recording") + await asyncio.sleep(3) + with open(self.manifest_file) as manifest: + for line in manifest: + self.platform.run_adb_command(line) + self.screen_pull = False async def stop(self): self.logger.info("Stopping screen proc")