mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
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
@ -45,7 +45,9 @@ class Host(object):
|
||||
|
||||
def ping(self):
|
||||
"""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:
|
||||
pinger.communicate()
|
||||
return pinger.returncode == 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user