contrib: Use text=True in subprocess over manual encoding handling

All touched Python scripts already assume and require UTF8, so manually
specifying encoding or decoding for functions in the subprocess module
is redundant to just using text=True, which exists since Python 3.7
This commit is contained in:
MarcoFalke committed 2025-11-26 11:31:29 +01:00
1 parent fa71c15f86
commit fab085c15f
12 files changed
+43 -47

No files matched your search

+2 -2
View File
@@ -27,10 +27,10 @@ def get_shell_files_list():
'*.sh',
]
try:
return subprocess.check_output(command, stderr = subprocess.STDOUT).decode('utf-8').splitlines()
return subprocess.check_output(command, stderr = subprocess.STDOUT, text=True).splitlines()
except subprocess.CalledProcessError as e:
if e.returncode > 1: # return code is 1 when match is empty
print(e.output.decode('utf-8'), end='')
print(e.output, end='')
sys.exit(1)
return []