From ff87aa0fc21fad54ab4475904b8657fa2ed17a9d Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Mon, 28 Aug 2023 18:48:22 -0400 Subject: [PATCH] cmdinterface: Ensure all buffered data is written to unix socket before quitting --- src/stdinreader.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/stdinreader.cpp b/src/stdinreader.cpp index 8fa9ffea706..88acbd37954 100644 --- a/src/stdinreader.cpp +++ b/src/stdinreader.cpp @@ -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) {