commit:     f69c2596ff6f483bec55c17918e4e17df6236b89
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Mon May 13 15:15:03 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 20 04:44:54 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f69c2596

get_vm_info: Set C locale for subprocesses.

Parsing of localized output of subprocesses would fail, making
`emerge --info` not display information about memory and swap.

Bug: https://bugs.gentoo.org/685854
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/util/_get_vm_info.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/portage/util/_get_vm_info.py b/lib/portage/util/_get_vm_info.py
index e8ad93805..802365dd7 100644
--- a/lib/portage/util/_get_vm_info.py
+++ b/lib/portage/util/_get_vm_info.py
@@ -1,4 +1,4 @@
-# Copyright 2013 Gentoo Foundation
+# Copyright 2013-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import os
@@ -11,10 +11,13 @@ def get_vm_info():
 
        vm_info = {}
 
+       env = os.environ.copy()
+       env["LC_ALL"] = "C"
+
        if platform.system() == 'Linux':
                try:
                        proc = subprocess.Popen(["free"],
-                               stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT)
+                               stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT, env=env)
                except OSError:
                        pass
                else:
@@ -49,7 +52,7 @@ def get_vm_info():
 
                try:
                        proc = subprocess.Popen(["sysctl", "-a"],
-                               stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT)
+                               stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT, env=env)
                except OSError:
                        pass
                else:

Reply via email to