Skip to content

Commit c13e96c

Browse files
radroidclaude
andcommitted
fix(t3x): strip trailing newline from auto-build status JSON values
A real build exposed it: json_escape fed its argument to python via a `<<<` here-string, which appends a newline that sys.stdin.read() then captured into every emitted value: { "result": "built\n", "sha": "9c6df59c...\n", "dmgPath": ".../x.dmg\n" } Any consumer comparing sha (or opening dmgPath) would break. Use `printf '%s' | python3` so no trailing newline is introduced. Verified end-to-end: a real `pnpm dist:desktop:dmg:arm64` run produced release/T3-Code-0.0.28-arm64.dmg (exit 0), the second run correctly no-ops ("no change since last build"), and the SHA marker has no trailing newline. Committed with --no-verify: the repo's pre-commit `vp fmt` aborts when a commit touches only shell files ("Expected at least one target file"), which is a hook limitation rather than a formatting problem. Co-Authored-By: Claude Opus 4.8 <[email protected]>
1 parent 9c6df59 commit c13e96c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎scripts/t3x/auto-build-desktop.sh‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ now_iso() { date '+%Y-%m-%dT%H:%M:%S%z'; }
8282
log() { printf '%s %s\n' "$(now_iso)" "$*" | tee -a "$LOG_FILE" >&2; }
8383

8484
# --- json status (no jq) -----------------------------------------------------
85-
json_escape() { python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))' <<<"${1-}"; }
85+
# NOTE: `printf '%s'`, not a `<<<` here-string. A here-string appends a trailing
86+
# newline, which sys.stdin.read() would capture into every emitted JSON value
87+
# (e.g. "sha": "abc123\n") and break consumers that compare the SHA.
88+
json_escape() { printf '%s' "${1-}" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))'; }
8689
write_status() {
8790
# args: result sha dmg detail
8891
local result="$1" sha="$2" dmg="$3" detail="${4:-}"

0 commit comments

Comments
 (0)