Fix jq parse error on parallel iOS commands (iscreenshot -a)#233
Open
vrbajiva wants to merge 1 commit into
Open
Fix jq parse error on parallel iOS commands (iscreenshot -a)#233vrbajiva wants to merge 1 commit into
vrbajiva wants to merge 1 commit into
Conversation
All iOS commands shared a single temp file (/private/tmp/mobile-toolkit-cache) for go-ios output. When iscreenshot -a runs device-info gathering concurrently per device, one job overwrote the file while another was reading it with jq, yielding garbled JSON and "jq: parse error: Invalid numeric literal". ios_device_info now uses a per-device temp file keyed by the (unique) UDID, so concurrent jobs never collide. Callees (ios_check_pairing, ios_check_developer_image) inherit the value via bash dynamic scope, and the file is cleaned up afterwards. Matches the existing per-invocation temp-file idiom already used in iinstall and irecord. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running
iscreenshot -a(or other parallel iOS commands) prints:Screenshots still save, but the error is printed for every-but-one device.
Cause
All iOS commands share a single temp file for
go-iosoutput:iscreenshot -arunsscreenshot "$ID" &per device concurrently. Each callsios_device_info, which doesgo-ios info > "$TEMPORARY_FILE"and immediately reads it back withjq. With multiple devices, one job overwrites the file while another is mid-read → garbled/partial JSON → thejqparse error. Single-device runs never hit it (no concurrency).Fix
ios_device_infonow uses a per-device temp file keyed by the (unique) UDID, so concurrent jobs never collide:ios_check_pairing,ios_check_developer_image) inherit the value via bash dynamic scope, so the whole chain stays consistent.rm -f) afterwards.iinstallandirecord.Testing
shellcheck(with the CI-disabled rulesSC1090/SC2207/SC2001/SC1091) reports no new findings vs. before the change.changelog.txtupdated per CONTRIBUTING.🤖 Generated with Claude Code