1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-09 07:14:13 +01:00

All braches/trunk:

- Force locale settings to C before running commands with piped output.
This commit is contained in:
imdano
2008-08-29 14:49:37 +00:00
parent 5a20b38e79
commit 9639cc8a14

View File

@@ -22,6 +22,7 @@ import locale
import gettext import gettext
import sys import sys
from subprocess import Popen, STDOUT, PIPE from subprocess import Popen, STDOUT, PIPE
from copy import copy
import subprocess import subprocess
import commands import commands
@@ -76,7 +77,11 @@ def Run(cmd, include_stderr=False, return_pipe=False):
err = None err = None
fds = False fds = False
f = Popen(cmd, shell=True, stdout=PIPE, stderr=err, close_fds=fds) tmpenv = copy(os.environ)
tmpenv["LC_ALL"] = "C"
tmpenv["LANG"] = "C"
f = Popen(cmd, shell=True, stdout=PIPE, stderr=err, close_fds=fds,
env=tmpenv)
if return_pipe: if return_pipe:
return f.stdout return f.stdout