From 2185df2a813f395e31ac016088393d230b572cab Mon Sep 17 00:00:00 2001 From: Till Maas Date: Wed, 23 May 2018 18:31:54 +0200 Subject: [PATCH] Always run commands in C locale --- library/network_connections.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/network_connections.py b/library/network_connections.py index 64bea1d..efcc9a6 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -83,13 +83,14 @@ class Util: return default @staticmethod - def check_output(argv, lang = None): + def check_output(argv): # subprocess.check_output is python 2.7. with open('/dev/null', 'wb') as DEVNULL: import subprocess - ev = os.environ.copy() - ev['LANG'] = lang if lang is not None else 'C' - p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=DEVNULL, env=ev) + env = os.environ.copy() + env['LANG'] = 'C' + p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=DEVNULL, + env=env) # FIXME: Can we assume this to always be UTF-8? out = p.communicate()[0].decode("UTF-8") if p.returncode != 0: