fuzzyworld

north-star / commit

ci pasta!

d2728f111d8999d77f17ee389d42e8cf229922ff · Pavel Safronov · 2026-03-16 14:46:55 -0700 · parents 92759929660a

ci pasta!
 scripts/clean-old-firebase.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/clean-old-firebase.sh b/scripts/clean-old-firebase.sh
index 31ced34..29f6101 100755
--- a/scripts/clean-old-firebase.sh
+++ b/scripts/clean-old-firebase.sh
@@ -41,12 +41,13 @@ sanitize_firebase_json_output() {
     local clean
     clean=$(printf '%s\n' "$raw" | sed -E 's/\x1B\[[0-9;]*[A-Za-z]//g' | sed '/^[[:space:]]*$/d')
 
-    # Some firebase-tools builds append a trailing {"status":"success"} object.
-    # Keep only the payload emitted before that footer.
+    # firebase-tools can print warnings before payload and/or append
+    # a trailing status object. Select only the first real payload line.
+    # Expected payload is compact JSON object or literal null.
     clean=$(printf '%s\n' "$clean" | awk '
-        BEGIN { stop = 0 }
-        /^\{[[:space:]]*"status"[[:space:]]*:[[:space:]]*"success"/ { stop = 1 }
-        stop == 0 { print }
+        /^[[:space:]]*null[[:space:]]*$/ { print "null"; exit }
+        /^[[:space:]]*\{[[:space:]]*"status"[[:space:]]*:/ { next }
+        /^[[:space:]]*\{/ { print; exit }
     ')
 
     printf '%s' "$clean"