Skip to content

Commit 21715b2

Browse files
authored
fix: potential race condition when checking availability of wda (#163)
1 parent 5b8835c commit 21715b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

devices/ios.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,9 +834,13 @@ func (d IOSDevice) OpenURL(url string) error {
834834
return d.wdaClient.OpenURL(url)
835835
}
836836

837-
func (d IOSDevice) ListApps() ([]InstalledAppInfo, error) {
837+
func (d *IOSDevice) ListApps() ([]InstalledAppInfo, error) {
838838
log.SetLevel(log.WarnLevel)
839839

840+
// Lock to prevent concurrent access to usbmuxd (race condition on ReadPair)
841+
d.mu.Lock()
842+
defer d.mu.Unlock()
843+
840844
// ensure tunnel is running for iOS 17+
841845
err := d.startTunnel()
842846
if err != nil {

0 commit comments

Comments
 (0)