From 9639cc8a14c455fa88560a3d28beb11f27248411 Mon Sep 17 00:00:00 2001 From: imdano <> Date: Fri, 29 Aug 2008 14:49:37 +0000 Subject: [PATCH] All braches/trunk: - Force locale settings to C before running commands with piped output. --- wicd/misc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wicd/misc.py b/wicd/misc.py index f76f9b3..1fc10be 100644 --- a/wicd/misc.py +++ b/wicd/misc.py @@ -22,6 +22,7 @@ import locale import gettext import sys from subprocess import Popen, STDOUT, PIPE +from copy import copy import subprocess import commands @@ -76,7 +77,11 @@ def Run(cmd, include_stderr=False, return_pipe=False): err = None 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: return f.stdout