Update network.py

This commit is contained in:
Félix Aimé 2021-01-13 16:46:35 +01:00 committed by GitHub
parent a93d6c7d5f
commit c272bfebeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -301,7 +301,9 @@ class Network(object):
This enable interfaces, with a simple check.
:return: bool if everything goes well
"""
sh = sp.Popen(["ifconfig", iface],
stdout=sp.PIPE, stderr=sp.PIPE)
sh = sh.communicate()
if b"<UP," in sh[0]:
return True # The interface is up.
elif sh[1]: