mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-08 07:24:21 +00:00
FRITZBOX: Handles error: No STDOUT from shell command
git-svn-id: https://svn.fhem.de/fhem/trunk@7904 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
401a14017b
commit
4c40644f9b
@ -788,6 +788,7 @@ sub FRITZBOX_Readout_Run($)
|
||||
for (1..$fonCount)
|
||||
{
|
||||
push @readoutCmdArray, ["fon".$_, "ctlmgr_ctl r telcfg settings/MSN/Port".($_-1)."/Name" ];
|
||||
push @readoutCmdArray, ["fon".$_."_out", "ctlmgr_ctl r telcfg settings/MSN/Port".($_-1)."/MSN" ];
|
||||
}
|
||||
$resultArray = FRITZBOX_Readout_Query( $hash, \@readoutCmdArray, \@readoutReadings );
|
||||
|
||||
@ -795,7 +796,7 @@ sub FRITZBOX_Readout_Run($)
|
||||
for (1..$fonCount)
|
||||
{
|
||||
push @readoutReadings, "fon".$_."_intern|".$_
|
||||
if $resultArray->[$_-1];
|
||||
if $resultArray->[($_-1)*2];
|
||||
}
|
||||
|
||||
# Prepare new command array
|
||||
@ -2284,8 +2285,8 @@ FRITZBOX_Exec_Remote($$)
|
||||
}
|
||||
|
||||
# Executed the command on the FritzBox Shell
|
||||
sub ############################################
|
||||
FRITZBOX_Exec_Local($$)
|
||||
############################################
|
||||
sub FRITZBOX_Exec_Local($$)
|
||||
{
|
||||
my ($hash, $cmd) = @_;
|
||||
|
||||
@ -2307,6 +2308,11 @@ FRITZBOX_Exec_Local($$)
|
||||
my $cmdStr = join "\necho ' |#|'\n", @{$cmd};
|
||||
$cmdStr .= "\necho ' |#|'";
|
||||
my $result = qx($cmdStr);
|
||||
unless (defined $result)
|
||||
{
|
||||
FRITZBOX_Log $hash, 1, "Error: No STDOUT from shell command.";
|
||||
return undef;
|
||||
}
|
||||
$result =~ s/\n|\r//g;
|
||||
my @resultArray = split /\|#\|/, $result;
|
||||
foreach (keys @resultArray)
|
||||
|
Loading…
x
Reference in New Issue
Block a user