[damned-lies] Ensure Popen commands are utf-8 encoded



commit 3b742d1b6716ed934a34c8e19b5252a8511d2c0a
Author: Claude Paroz <claude 2xlibre net>
Date:   Mon Mar 31 09:26:17 2014 +0200

    Ensure Popen commands are utf-8 encoded

 stats/utils.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/stats/utils.py b/stats/utils.py
index 8fc73dd..3a56592 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -129,6 +129,8 @@ def run_shell_command(cmd, env=None, input_data=None, raise_on_error=False):
     if env:
         os.environ.update(env)
         env = os.environ
+    if isinstance(cmd, unicode):
+        cmd = cmd.encode('utf-8')
     pipe = Popen(cmd, shell=True, env=env, stdin=stdin, stdout=PIPE, stderr=PIPE)
     if input_data:
         try:


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