================ @@ -58,16 +56,19 @@ Error OutputRedirector::RedirectTo(std::function<void(StringRef)> callback) { char buffer[OutputBufferSize]; while (!m_stopped) { ssize_t bytes_count = ::read(read_fd, &buffer, sizeof(buffer)); - // EOF detected. - if (bytes_count == 0) - break; if (bytes_count == -1) { // Skip non-fatal errors. if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK) continue; break; } + StringRef data(buffer, bytes_count); + if (m_stopped) + data.consume_back(kCloseSentinel); + if (data.empty()) + break; + callback(StringRef(buffer, bytes_count)); ---------------- labath wrote:
```suggestion callback(data); ``` https://github.com/llvm/llvm-project/pull/126833 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits