Fix overloaded command pipe errors

fixes #11390
This commit is contained in:
Michael Friedrich 2016-05-09 16:14:48 +02:00 committed by Gunnar Beutner
parent 63445398c0
commit b39634d948
1 changed files with 8 additions and 3 deletions

View File

@ -115,13 +115,18 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath)
try { try {
rc = sock->Read(buffer, sizeof(buffer)); rc = sock->Read(buffer, sizeof(buffer));
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
/* We have read all data. */
if (errno == EAGAIN)
continue;
Log(LogWarning, "ExternalCommandListener") Log(LogWarning, "ExternalCommandListener")
<< "Cannot read from socket." << DiagnosticInformation(ex); << "Cannot read from command pipe." << DiagnosticInformation(ex);
break; break;
} }
if (rc <= 0) /* Empty pipe (EOF) */
break; if (rc == 0)
continue;
fifo->Write(buffer, rc); fifo->Write(buffer, rc);