[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Run programs with LC_ALL=C in case we're parsing output (#492549).



---
 iutil.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/iutil.py b/iutil.py
index 221504f..7d90c9f 100644
--- a/iutil.py
+++ b/iutil.py
@@ -81,11 +81,15 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
     runningLog = open("/tmp/program.log", "a")
     runningLog.write("Running... %s\n" % ([command] + argv,))
 
+    env = os.environ.copy()
+    env.update({"LC_ALL": "C"})
+
     try:
         proc = subprocess.Popen([command] + argv, stdin=stdin,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,
-                                preexec_fn=chroot, cwd=root)
+                                preexec_fn=chroot, cwd=root
+                                env=env)
 
         while True:
             (outStr, errStr) = proc.communicate()
@@ -143,11 +147,15 @@ def execWithCapture(command, argv, stdin = None, stderr = None, root='/'):
     runningLog = open("/tmp/program.log", "a")
     runningLog.write("Running... %s\n" % ([command] + argv,))
 
+    env = os.environ.copy()
+    env.update({"LC_ALL": "C"})
+
     try:
         proc = subprocess.Popen([command] + argv, stdin=stdin,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,
-                                preexec_fn=chroot, cwd=root)
+                                preexec_fn=chroot, cwd=root,
+                                env=env)
 
         while True:
             (outStr, errStr) = proc.communicate()
-- 
1.6.1.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]