only run ip on linux

This commit is contained in:
j 2016-01-31 12:17:03 +05:30
parent 3c58e95948
commit a3f6e3da3a

View file

@ -239,7 +239,7 @@ def get_local_ipv4():
ips = [l for l in stdout.split('\n') if 'inet ' in l]
if ips:
ip = ips[0].strip().split(' ')[1]
else:
elif sys.platform.startswith('linux'):
cmd = ['ip', 'route', 'show']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True)
stdout, stderr = p.communicate()