Skip to content

Commit 6a440dc

Browse files
OMOTO Kenjinir0s
authored andcommitted
Stdout of shell should be decoded with sys.getfilesystemencoding()
1 parent 8faff9b commit 6a440dc

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

distro.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ def _get_lsb_release_info(self):
920920
stdout = subprocess.check_output(cmd, stderr=devnull)
921921
except OSError: # Command not found
922922
return {}
923-
content = stdout.decode('UTF-8').splitlines()
923+
content = stdout.decode(sys.getfilesystemencoding()).splitlines()
924924
return self._parse_lsb_release_content(content)
925925

926926
@staticmethod
@@ -939,7 +939,6 @@ def _parse_lsb_release_content(lines):
939939
"""
940940
props = {}
941941
for line in lines:
942-
line = line.decode('utf-8') if isinstance(line, bytes) else line
943942
kv = line.strip('\n').split(':', 1)
944943
if len(kv) != 2:
945944
# Ignore lines without colon.

0 commit comments

Comments
 (0)