Skip to content

Commit 1f74b9e

Browse files
authored
Fix c-analyzer for GCC: ignore LANG env var (#106173)
The c-analyzer doesn't support GCC localized messages, so just unset the LANG environment variable.
1 parent adaacf2 commit 1f74b9e

File tree

1 file changed

+7
-1
lines changed
  • Tools/c-analyzer/c_parser/preprocessor

1 file changed

+7
-1
lines changed

Tools/c-analyzer/c_parser/preprocessor/common.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import contextlib
22
import distutils.ccompiler
33
import logging
4+
import os
45
import shlex
56
import subprocess
67
import sys
@@ -40,7 +41,12 @@ def run_cmd(argv, *,
4041
kw.pop('kwargs')
4142
kwargs.update(kw)
4243

43-
proc = subprocess.run(argv, **kwargs)
44+
# Remove LANG environment variable: the C parser doesn't support GCC
45+
# localized messages
46+
env = dict(os.environ)
47+
env.pop('LANG', None)
48+
49+
proc = subprocess.run(argv, env=env, **kwargs)
4450
return proc.stdout
4551

4652

0 commit comments

Comments
 (0)