[damned-lies] Partial revert of c5b979de0c0da6



commit 76ebf51e276a7396bf24ec0613738edda8531c40
Author: Claude Paroz <claude 2xlibre net>
Date:   Sun Feb 26 22:08:08 2017 +0100

    Partial revert of c5b979de0c0da6
    
    Encoding commands passed to Popen seems still useful in some cases.
    Fixes bug #779227.

 stats/utils.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/stats/utils.py b/stats/utils.py
index 3163644..e1bdc45 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -115,6 +115,10 @@ def run_shell_command(cmd, input_data=None, raise_on_error=False, env=None, **po
     if env is not None:
         env = dict(os.environ, **env)
     shell = not isinstance(cmd, list)
+    if isinstance(cmd, str):
+        cmd = cmd.encode('utf-8')
+    elif isinstance(cmd, list):
+        cmd = [c.encode('utf-8') for c in cmd]
     pipe = Popen(cmd, shell=shell, stdin=stdin, stdout=PIPE, stderr=PIPE, env=env, **popen_kwargs)
     if input_data:
         try:


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