Converted partprobe call into a function.

This commit is contained in:
Anton Hvornum 2021-11-11 18:40:41 +01:00
parent 6d2126a597
commit c0bf44e0ae
1 changed files with 4 additions and 1 deletions

View File

@ -112,8 +112,8 @@ class BlockDevice:
@property
def partitions(self):
from .filesystem import Partition
SysCommand(['partprobe', self.path])
self.partprobe()
result = SysCommand(['/usr/bin/lsblk', '-J', self.path])
if b'not a block device' in result:
@ -202,6 +202,9 @@ class BlockDevice:
info = space_info
return info
def partprobe(self):
SysCommand(['partprobe', self.path])
def has_partitions(self):
return len(self.partitions)