catch try implementation for

sysread and syswrite

[Ticket: #9]
This commit is contained in:
Marko Oldenburg 2022-03-29 08:01:37 +02:00
parent 4c92240cc5
commit 3845e508c7
3 changed files with 18 additions and 4 deletions

View File

@ -368,7 +368,7 @@ __END__
],
"release_status": "stable",
"license": "GPL_2",
"version": "v3.6.3",
"version": "v3.6.5",
"author": [
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
],

View File

@ -1,2 +1,2 @@
UPD 2022-03-17_11:00:18 18968 FHEM/82_LGTV_WebOS.pm
UPD 2022-03-17_10:59:44 54628 lib/FHEM/Devices/LGTV/LGTVWebOS.pm
UPD 2022-03-29_08:00:00 18968 FHEM/82_LGTV_WebOS.pm
UPD 2022-03-29_07:50:12 54974 lib/FHEM/Devices/LGTV/LGTVWebOS.pm

View File

@ -704,7 +704,21 @@ sub Write {
unless ( $hash->{CD} );
::Log3( $name, 4, "LGTV_WebOS ($name) - $string" );
syswrite( $hash->{CD}, $string );
try {
syswrite( $hash->{CD}, $string );
}
catch {
if ( $_->isa('autodie::exception') && $_->matches(':io') ) {
Log3( $name, 2, "LGTV_WebOS ($name) - can't write to socket: $_" );
return;
}
else {
Log3( $name, 2, "LGTV_WebOS ($name) - can't write too socket: $_" );
return;
}
};
return;
}