From b587642048b9f75cdc08d4d9e3fa03f14811cc21 Mon Sep 17 00:00:00 2001 From: Oyvind Albrigtsen Date: Fri, 20 Apr 2018 15:16:42 +0200 Subject: [PATCH 5/5] run_command: fix Python 3 encoding issue --- fence/agents/lib/fencing.py.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index 5b38460e..15914f0f 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -995,7 +995,9 @@ def run_command(options, command, timeout=None, env=None, log_command=None): logging.info("Executing: %s\n", log_command or command) try: - process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) + process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, + # decodes newlines and in python3 also converts bytes to str + universal_newlines=(sys.version_info[0] > 2)) except OSError: fail_usage("Unable to run %s\n" % command) -- 2.16.3