mirror of
https://github.com/home-assistant/core.git
synced 2026-04-28 18:12:37 +02: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:
committed by
Paulus Schoutsen
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
|
||||
|
||||
Reference in New Issue
Block a user