2
0
mirror of https://github.com/mbusb/multibootusb synced 2024-11-18 15:25:46 +00:00

Fix crash when fdisk fails on usb disk device

In the event that `fdisk -l` fails on a partition or device (e.g., a
usb card reader has no media), don't crash the program.  Just return
None, since this is just a partition that the program can't use.

Fixes #180.
This commit is contained in:
Alan Moore 2017-10-02 19:55:42 -05:00
parent 807756981c
commit 800e07aa96

View File

@ -219,7 +219,11 @@ def details_udev(usb_disk_part):
gen.log("ERROR: Unknown disk/partition (%s)" % str(usb_disk_part))
return None
try:
fdisk_cmd_out = subprocess.check_output('fdisk -l ' + usb_disk_part, shell=True)
except subprocess.CalledProcessError:
gen.log("ERROR: fdisk failed on disk/partition (%s)" % str(usb_disk_part))
return None
if b'Extended' in fdisk_cmd_out:
mount_point = ''