Skip to content

Commit

Permalink
Remove i18n when calling shell commands
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWilhelm committed Jan 1, 2022
1 parent 5f02572 commit fbdb83e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pyscaffold/shell.py
Expand Up @@ -67,12 +67,10 @@ def __init__(
command: str,
shell: bool = True,
cwd: Optional[str] = None,
env: Optional[Dict[str, str]] = None,
):
self._command = command
self._shell = shell
self._cwd = cwd
self._env = env

def run(self, *args, **kwargs) -> subprocess.CompletedProcess:
"""Execute command with the given arguments via :obj:`subprocess.run`."""
Expand All @@ -89,7 +87,11 @@ def run(self, *args, **kwargs) -> subprocess.CompletedProcess:
"stdout": subprocess.PIPE,
"stderr": subprocess.STDOUT,
"universal_newlines": True,
"env": self._env,
"env": {
**os.environ,
# try to disable i18n
**dict(LC_ALL="C", LANGUAGE=""),
},
**kwargs, # allow overwriting defaults
}
if self._shell:
Expand Down

0 comments on commit fbdb83e

Please sign in to comment.