Fixed a issue with blkid where it would raise an exception when there was not filesystem on the partition.

This commit is contained in:
Anton Hvornum 2021-03-09 11:54:03 +01:00
parent ce646a9394
commit 4e8084bddb
1 changed files with 3 additions and 2 deletions

View File

@ -487,5 +487,6 @@ def get_mount_info(path):
return output['filesystems'][0]
def get_filesystem_type(path):
output = b''.join(sys_command(f"blkid -o value -s TYPE {path}"))
return output.strip().decode('UTF-8')
if (handle := sys_command(f"blkid -o value -s TYPE {path}")).exit_code != 0:
return None
return b''.join(handle).strip().decode('UTF-8')