Fix AFC Connection errors when --device is specified #1876
Merged
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.
When
--device
is specified, CLI is trying to find all currently attached devices and check if the passed option is valid. This leads to starting of a setInterval, that is trying to detect when new device is attached.The setInterval is executed on 2 seconds and it starts iOS related services and adb related services. It looks like this breaks the execution of AFC service.
Fix this by using a method that do not start the setInterval, but detects all currently detected devices.
This fix errors like:
Error: Unable to close afc file connection: '4361027664'. Result is: '3'
and
Error: Unable to write to file: '4361027664'. Result is: '11'
when
--device
is used.