Send stderr of ping tracker to devnull (#7096)
When pinging an inaccessible device, OS errors like ping: sendto: No route to host can occur. For a ping tracker this is not an error but rather a normal situation. Thus, it makes sense to hide the error.
This commit is contained in:
parent
f7b6f8e8fb
commit
6cbe28a9cd
1 changed files with 3 additions and 1 deletions
|
@ -45,7 +45,9 @@ class Host(object):
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
"""Send an ICMP echo request and return True if success."""
|
"""Send an ICMP echo request and return True if success."""
|
||||||
pinger = subprocess.Popen(self._ping_cmd, stdout=subprocess.PIPE)
|
pinger = subprocess.Popen(self._ping_cmd,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.DEVNULL)
|
||||||
try:
|
try:
|
||||||
pinger.communicate()
|
pinger.communicate()
|
||||||
return pinger.returncode == 0
|
return pinger.returncode == 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue