Skip to content

Commit 85feea1

Browse files
fix: decode ret if necessary
Signed-off-by: Mathieu Labourier <[email protected]>
1 parent e88ba1a commit 85feea1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libs/sm/vhdutil.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ def ioretry(cmd, text=True):
9696
def getBlockSize(path):
9797
cmd = [VHD_UTIL, "read", "-pn", path]
9898
ret = ioretry(cmd)
99+
if isinstance(ret, bytes):
100+
import locale
101+
ret = ret.decode(
102+
encoding = locale.getpreferredencoding(False),
103+
errors="replace"
104+
)
99105
fields = ret.strip().split('\n')
100106
for field in fields:
101107
field = field.strip()

0 commit comments

Comments
 (0)