Set codec error handler for git hash detection

This commit is contained in:
Adam Turner 2023-08-05 03:50:52 +01:00
parent 92c4874620
commit 062a2e1d05

View File

@ -40,13 +40,13 @@ if _in_development:
import subprocess
try:
ret = subprocess.run(
['git', 'show', '-s', '--pretty=format:%h'],
if ret := subprocess.run(
['git', 'rev-parse', '--short', 'HEAD'],
cwd=package_dir,
capture_output=True,
encoding='ascii',
).stdout
if ret:
errors='surrogateescape',
).stdout:
__display_version__ += '+/' + ret.strip()
del ret
finally: