Util: Python 2.6 compatibility fix

This commit is contained in:
Thomas Perl 2012-11-23 12:03:55 +01:00
parent 16ddd925a5
commit 831cbde7fc

View file

@ -1635,7 +1635,8 @@ def linux_get_active_interfaces():
empty list if the device is offline. The loopback
interface is not included.
"""
data = subprocess.check_output(['ip', 'link'])
process = subprocess.Popen(['ip', 'link'], stdout=subprocess.PIPE)
data, _ = process.communicate()
for interface, _ in re.findall(r'\d+: ([^:]+):.*state (UP|UNKNOWN)', data):
if interface != 'lo':
yield interface