Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

tools: drop an indented status line from the screencap error text too

unfoldcroe36516392144
diff --git a/tests/test_tv_screenshot.py b/tests/test_tv_screenshot.py
index 83209dd82..4bfcebd80 100644
--- a/tests/test_tv_screenshot.py
+++ b/tests/test_tv_screenshot.py
@@ -162,6 +162,10 @@ class ScreenshotTest(unittest.TestCase):
capture=b"", screencap_says=" rc=127\n")
self.assertEqual(code, 1)
self.assertIn("exit status 127", err)
+ # The status line is matched after stripping, so it is dropped from the error text the
+ # same way: an indented "rc=127" should not come back as the screencap output.
+ self.assertNotIn("rc=127", err)
+ self.assertIn("no output", err)
def test_a_damaged_pull_is_not_passed_off_as_a_png(self):
with tempfile.TemporaryDirectory() as tmp:
diff --git a/tools/tv.py b/tools/tv.py
index ca22629d1..360457106 100644
--- a/tools/tv.py
+++ b/tools/tv.py
@@ -206,7 +206,7 @@ def screenshot(dev, local, keys=(), wait=1.0):
said = dev.shell(f"rm -f {SHOT_REMOTE}; screencap -p {SHOT_REMOTE}; echo rc=$?", read_timeout_s=120.0)
rc = next((int(line.strip()[3:]) for line in said.splitlines() if re.fullmatch(r"rc=-?\d+", line.strip())), None)
if rc not in (None, 0, 1):
- other = " ".join(line.strip() for line in said.splitlines() if line.strip() and not line.startswith("rc="))
+ other = " ".join(line.strip() for line in said.splitlines() if line.strip() and not line.strip().startswith("rc="))
dev.shell(f"rm -f {SHOT_REMOTE}", read_timeout_s=60.0)
print(f"screencap failed on the TV (exit status {rc}): {other or 'no output'}", file=sys.stderr)
return 1