##// END OF EJS Templates
Fix loading IP addresses from subprocess output
Thomas Kluyver -
Show More
@@ -27,7 +27,6 b' import socket'
27 27
28 28 from .data import uniq_stable
29 29 from .process import get_output_error_code
30 from .py3compat import bytes_to_str
31 30 from .warn import warn
32 31
33 32 #-----------------------------------------------------------------------------
@@ -96,11 +95,11 b' def _load_ips_ifconfig():'
96 95 if rc:
97 96 raise IOError("no ifconfig: %s" % err)
98 97
99 lines = bytes_to_str(out).splitlines()
98 lines = out.splitlines()
100 99 addrs = []
101 100 for line in lines:
102 101 blocks = line.lower().split()
103 if blocks[0] == 'inet':
102 if (len(blocks) >= 2) and (blocks[0] == 'inet'):
104 103 addrs.append(blocks[1])
105 104 _populate_from_list(addrs)
106 105
@@ -111,11 +110,11 b' def _load_ips_ip():'
111 110 if rc:
112 111 raise IOError("no ip: %s" % err)
113 112
114 lines = bytes_to_str(out).splitlines()
113 lines = out.splitlines()
115 114 addrs = []
116 115 for line in lines:
117 116 blocks = line.lower().split()
118 if blocks[0] == 'inet':
117 if (len(blocks) >= 2) and (blocks[0] == 'inet'):
119 118 addrs.append(blocks[1].split('/')[0])
120 119 _populate_from_list(addrs)
121 120
@@ -126,7 +125,7 b' def _load_ips_ipconfig():'
126 125 if rc:
127 126 raise IOError("no ipconfig: %s" % err)
128 127
129 lines = bytes_to_str(out).splitlines()
128 lines = out.splitlines()
130 129 addrs = ['127.0.0.1']
131 130 for line in lines:
132 131 line = line.lower().split()
General Comments 0
You need to be logged in to leave comments. Login now