From 29bc2ac30d1b3734b2c958011f3d9defa078738f Mon Sep 17 00:00:00 2001 From: markusbloch Date: Tue, 7 Oct 2014 21:24:25 +0000 Subject: [PATCH] PRESENCE: rerouting STDERR to STDOUT for ping; use char class instead of case-in-sensitive regexp (Forum #27558) git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@6706 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/73_PRESENCE.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/73_PRESENCE.pm b/fhem/FHEM/73_PRESENCE.pm index 498149958..7ce944927 100755 --- a/fhem/FHEM/73_PRESENCE.pm +++ b/fhem/FHEM/73_PRESENCE.pm @@ -582,17 +582,16 @@ PRESENCE_DoLocalPingScan($) { $return = "$name|$local|error|Could not execute ping command: \"ping -n $count -4 $device\""; } - } else { - $temp = qx(ping -c $count $device); + $temp = qx(ping -c $count $device 2>&1); chomp $temp; if($temp ne "") { Log3 $name, 5, "PRESENCE ($name) - ping command returned with output:\n$temp"; - $return = "$name|$local|".(($temp =~ /\d+ [Bb]ytes (from|von)/ and not $temp =~ /unreachable/i) ? "present" : "absent"); + $return = "$name|$local|".(($temp =~ /\d+ [Bb]ytes (from|von)/ and not $temp =~ /[Uu]nreachable/) ? "present" : "absent"); } else { @@ -601,7 +600,6 @@ PRESENCE_DoLocalPingScan($) } return $return; - } sub