Skip to content

Commit

Permalink
cmdinterface: Ensure all buffered data is written to unix socket befo…
Browse files Browse the repository at this point in the history
…re quitting
  • Loading branch information
past-due committed Sep 10, 2023
1 parent c7fe01f commit ff87aa0
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/stdinreader.cpp
Expand Up @@ -423,19 +423,16 @@ int cmdOutputThreadFunc(void *)
bool successfullyWroteMsg = false;
do {
// Wait to be ready to write
auto result = cmdIOIsReady(nullopt, writeFd, quitSignalFd);
auto result = cmdIOIsReady(nullopt, writeFd, -1); // do not wait on the quit signal fd here - all messages must be sent!
if (result == CmdIOReadyStatus::Exit)
{
// quit thread
return 0;
// ignore, and retry
continue;
}
else if (result == CmdIOReadyStatus::NotReady)
{
if (cmdOutputThreadQuit.load())
{
// quit thread
return 0;
}
// retry
continue;
}
else if (result == CmdIOReadyStatus::ReadyWrite)
{
Expand Down

0 comments on commit ff87aa0

Please sign in to comment.