Commit 1c7f523a authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

cerbero: Ignore env var values with invalid encoding on Windows

It seems that when the GitLab username contains non-ascii characters,
GitLab runner sets the GITLAB_USER_NAME env var to an invalid value
that is not valid in any locale:

```
GITLAB_USER_NAME=Sebastian Dr\xe2\x80\x9dge
```

https://gitlab.freedesktop.org/slomo/cerbero/-/jobs/4859194

This throws a UnicodeDecodeError. Ignore encoding errors to work
around this. These env vars will be discarded later anyway, since we
take the difference of the old env and the new env.

Part-of: <!631>
parent 19416280
Pipeline #210516 passed with stages
in 61 minutes and 35 seconds
......@@ -191,8 +191,13 @@ def run_and_get_env(cmd):
env = os.environ.copy()
env['VSCMD_ARG_no_logo'] = '1'
env['VSCMD_DEBUG'] = ''
# Pass errors=ignore to ignore env vars with invalid encoding, such as
# GITLAB_USER_NAME when the name of the user triggering the pipeline has
# non-ascii characters.
# The env vars set by MSVC will always be correctly encoded.
output = subprocess.check_output(cmd, shell=True, env=env,
universal_newlines=True)
universal_newlines=True,
errors='ignore')
lines = []
for line in output.split('\n'):
if '=' in line:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment