ExternalCommandListener: Fix crash when reading from socket

refs #10700
This commit is contained in:
Michael Friedrich 2016-01-20 16:38:31 +01:00
parent a51e647cc7
commit 4ce43b8d02
1 changed files with 10 additions and 1 deletions

View File

@ -110,7 +110,16 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath)
sock->Poll(true, false);
char buffer[8192];
size_t rc = sock->Read(buffer, sizeof(buffer));
size_t rc;
try {
rc = sock->Read(buffer, sizeof(buffer));
} catch (const std::exception& ex) {
Log(LogWarning, "ExternalCommandListener")
<< "Cannot read from socket." << DiagnosticInformation(ex);
break;
}
if (rc <= 0)
break;