Improve tunnel startup failure handling#89
Draft
Kahiy314 wants to merge 1 commit intoMTDickens:mainfrom
Draft
Conversation
The original tunnel bootstrap only waited for a line matching "--rsd HOST PORT". When the underlying pymobiledevice3 command exited early or failed before printing that line, the child process kept reading until the parent hit the 20-second timeout. Different root causes were therefore collapsed into the same generic tunnel failure, which made one-off environment issues hard to diagnose later. This commit keeps the upstream-facing behavior intact, including the existing 20-second timeout and raw subprocess output, but makes the failure path more explicit and easier to reason about. Changes: - run lockdown start-tunnel in script mode so successful output is easier to parse reliably - stop the child read loop when the subprocess exits without emitting an RSD address - forward recent subprocess output back to the parent so the real failure reason is visible - return early from main.py when tunnel startup fails, instead of continuing with an invalid process/address state - terminate the tunnel worker process defensively on failure to avoid leaving it running in the background Reason: - improve debugging when tunnel startup fails for transient causes such as permissions, trust state, or device readiness - avoid cascading follow-up errors after a failed tunnel bootstrap - keep the change narrow enough to stay suitable for a future upstream PR if needed
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.
The original tunnel bootstrap only waited for a line matching "--rsd HOST PORT". When the underlying pymobiledevice3 command exited early or failed before printing that line, the child process kept reading until the parent hit the 20-second timeout. Different root causes were therefore collapsed into the same generic tunnel failure, which made one-off environment issues hard to diagnose later.
This commit keeps the upstream-facing behavior intact, including the existing 20-second timeout and raw subprocess output, but makes the failure path more explicit and easier to reason about.
Changes: