From a44b4422fd0f62c0cd8be05c376fb64b8efd361b Mon Sep 17 00:00:00 2001 From: KeelrLeek <156356974+KeelrLeek@users.noreply.github.com> Date: Tue, 15 Sep 2026 07:48:09 -0500 Subject: [PATCH] android: the same SIGPIPE race, in the two focus checks it has not lost yet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit deploy.sh and dev.sh both ask which app is on screen with `echo "$FOCUS" | grep -qi`, under the same `set -o pipefail`. $FOCUS is one line, so echo has always finished writing before grep -q exits and the race has never been lost — but it is the identical shape that made verify-icon.sh report a missing file in an APK that contained it. Herestrings, so there is no writer to kill. --- src-tauri/android/deploy.sh | 8 +++++++- src-tauri/android/dev.sh | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src-tauri/android/deploy.sh b/src-tauri/android/deploy.sh index 830d915..35ab1ed 100644 --- a/src-tauri/android/deploy.sh +++ b/src-tauri/android/deploy.sh @@ -17,7 +17,13 @@ echo "== install $(date +%T)" # launch and screenshot only when the phone is ours to drive: SoulStream or # the launcher on screen. Never take the screen from another app. FOCUS=$("$ADB" shell dumpsys window 2>/dev/null | grep -a "mCurrentFocus" | head -1) -if echo "$FOCUS" | grep -qi "soulstream\|launcher"; then +# herestring, not `echo | grep -q`: grep -q exits on its match while echo is +# still writing, echo takes SIGPIPE, and the `pipefail` above promotes the +# dead writer's 141 to the pipeline — so the test reports "not focused" having +# just found SoulStream. $FOCUS is one line so it has never lost the race here, +# but it is the same bug that made verify-icon.sh answer fail/pass/fail to one +# unchanged APK. +if grep -qi "soulstream\|launcher" <<< "$FOCUS"; then "$ADB" shell am start -n com.soulstream.app/.MainActivity >/dev/null sleep 5 OUT="${SS_SHOT_DIR:-$(cygpath -u "$TEMP")}" diff --git a/src-tauri/android/dev.sh b/src-tauri/android/dev.sh index 9d85205..927cb0d 100644 --- a/src-tauri/android/dev.sh +++ b/src-tauri/android/dev.sh @@ -55,7 +55,8 @@ echo "== install $(date +%T)" "$ADB" reverse tcp:1421 tcp:1421 "$ADB" shell am force-stop com.soulstream.app FOCUS=$("$ADB" shell dumpsys window 2>/dev/null | grep -a "mCurrentFocus" | head -1) -if echo "$FOCUS" | grep -qi "soulstream\|launcher"; then +# herestring, for the reason spelled out in deploy.sh beside the same test +if grep -qi "soulstream\|launcher" <<< "$FOCUS"; then "$ADB" shell am start -n com.soulstream.app/.MainActivity >/dev/null echo "== launched $(date +%T) — serve the frontend on 1421 (npm run dev) if it is not up" else