Skip to content

Commit 4e96150

Browse files
hroncokfrenzymadness
authored andcommitted
Use C.utf8 locale when dealing with local ifconfig
1 parent 970f57b commit 4e96150

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/parse_ifconfig.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# net-tools-1.60/lib/interface.c
2626
# within ife_print_long()
2727

28+
import os
2829
import re
2930
from subprocess import Popen, PIPE
3031
import unittest
@@ -70,7 +71,9 @@ def __init__(self, stdout=None, debug=False):
7071
self.stdout = stdout
7172
self.stderr = ''
7273
else:
73-
p = Popen('ifconfig', stdout=PIPE, stderr=PIPE)
74+
env = os.environ.copy()
75+
env.update(LANG='C.utf8')
76+
p = Popen('ifconfig', stdout=PIPE, stderr=PIPE, env=env)
7477
self.stdout, self.stderr = p.communicate()
7578
if self.stderr != '':
7679
raise ValueError('stderr from ifconfig was nonempty:\n%s' % self.stderr)

0 commit comments

Comments
 (0)