refactor(runner,android): drop unused bringToForeground return; grep no-match yields empty

bringToForeground's bool return was read by no caller. FocusedWindowPackage's on-device grep exited 1 on no match, surfacing as an error instead of the documented ""; add || true.
This commit is contained in:
pj committed 2026-06-11 09:32:12 +05:30
1 parent c61114b2bb
commit 75281d8e16
2 files changed
+6 -7

No files matched your search

+3 -2
View File
@@ -456,8 +456,9 @@ func FocusedWindowPackage(ctx context.Context, serial string) (string, error) {
}
// Grep the focus line on-device: the full dumpsys window output is large and
// this runs on the per-step scope guard, so transferring it whole would add
// latency to every step.
output, err := exec.CommandContext(ctx, adb, adbArgs(serial, "shell", "dumpsys window | grep mCurrentFocus")...).Output()
// latency to every step. `|| true` keeps a no-match (grep exit 1) from
// surfacing as an error so it yields "" per the contract.
output, err := exec.CommandContext(ctx, adb, adbArgs(serial, "shell", "dumpsys window | grep mCurrentFocus || true")...).Output()
if err != nil {
return "", err
}