GeoView : differentiate ping between windows and linux.
svn: r14404
This commit is contained in:
parent
c59ee70155
commit
c2239ec0e7
@ -2291,16 +2291,18 @@ class GeoView(HtmlView):
|
|||||||
"""
|
"""
|
||||||
if constfunc.win():
|
if constfunc.win():
|
||||||
command = "ping -n 2 "
|
command = "ping -n 2 "
|
||||||
|
stringtosearch = "([0-9]*)%.*"
|
||||||
#elif constfunc.mac():
|
#elif constfunc.mac():
|
||||||
# command = "ping -c 2 "
|
# command = "ping -c 2 "
|
||||||
else:
|
else:
|
||||||
|
stringtosearch = ".*, (.*)% packet loss.*"
|
||||||
command = "ping -c 2 "
|
command = "ping -c 2 "
|
||||||
|
|
||||||
pinghost = os.popen(command + host, "r")
|
pinghost = os.popen(command + host, "r")
|
||||||
line = pinghost.read()
|
line = pinghost.read()
|
||||||
if not line:
|
if not line:
|
||||||
self.no_network = True
|
self.no_network = True
|
||||||
result = re.search('.*, (.*)% packet loss.*', line)
|
result = re.search(stringtosearch, line)
|
||||||
if result != None and int(result.group(1)) == 0:
|
if result != None and int(result.group(1)) == 0:
|
||||||
if self.no_network == True:
|
if self.no_network == True:
|
||||||
self.no_network = False
|
self.no_network = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user