Skip to content

Commit 6ed2114

Browse files
committed
Added check to ensure disk exists in both volumes and mounts
1 parent eac21bb commit 6ed2114

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

mbed_lstools/lstools_darwin.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,18 @@ def list_mbeds(self):
3535

3636
# {volume_id: {serial:, vendor_id:, product_id:, tty:}}
3737
volumes = self.get_mbed_volumes()
38-
#print 'volumes:', volumes
3938

4039
# {volume_id: mount_point}
4140
mounts = self.get_mount_points()
42-
#print "mounts:", mounts
41+
42+
volumes_keys = set(volumes.keys())
43+
mounts_keys = set(mounts.keys())
44+
intersection = volumes_keys & mounts_keys
45+
46+
valid_volumes = {}
47+
48+
for key in intersection:
49+
valid_volumes[key] = volumes[key]
4350

4451
# put together all of that info into the expected format:
4552
result = [
@@ -48,7 +55,7 @@ def list_mbeds(self):
4855
'serial_port': volumes[v]['tty'],
4956
'target_id': self.target_id(volumes[v]),
5057
'platform_name': self.platform_name(self.target_id(volumes[v]))
51-
} for v in volumes
58+
} for v in valid_volumes
5259
]
5360

5461
self.ERRORLEVEL_FLAG = 0

0 commit comments

Comments
 (0)