Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1479 by forcing always run_command to be on en_US locale #1492

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/rockstor/system/osi.py
Expand Up @@ -84,9 +84,14 @@ def run_command(cmd, shell=False, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stdin=subprocess.PIPE, throw=True,
log=False, input=None):
try:
#We force run_command to always use en_US
#to avoid issues on date and number formats
#on not Anglo-Saxon systems (ex. it, es, fr, de, etc)
fake_env = dict(os.environ)
fake_env['LANG'] = 'en_US.UTF-8'
cmd = map(str, cmd)
p = subprocess.Popen(cmd, shell=shell, stdout=stdout, stderr=stderr,
stdin=stdin)
stdin=stdin, env=fake_env)
out, err = p.communicate(input=input)
out = out.split('\n')
err = err.split('\n')
Expand Down