When stdout is in non-blocking mode, the first large output written via std::cout is silently truncated and all subsequent output is suppressed for the rest of the session - std::cout ends up permanently in an error state.
- first dump after connecting (any format, any datastore) prints, but is cut off in the middle
- after that, every command produces no output - commands run, nothing appears
Proposed fix
Don't rely on std::cout for output on a possibly non-blocking fd. Route output through a helper that writes to the fd in bounded chunks, retrying on EINTR and EAGAIN/EWOULDBLOCK (via poll).
I'd like to fix this upstream, but since it touches output across the whole app, I'd rather check how you'd prefer to handle it before opening a PR: whether to replace each std::cout call individually, route all output through a single wrapper, or something else entirely. Thanks!
When stdout is in non-blocking mode, the first large output written via std::cout is silently truncated and all subsequent output is suppressed for the rest of the session - std::cout ends up permanently in an error state.
Proposed fix
Don't rely on std::cout for output on a possibly non-blocking fd. Route output through a helper that writes to the fd in bounded chunks, retrying on EINTR and EAGAIN/EWOULDBLOCK (via poll).
I'd like to fix this upstream, but since it touches output across the whole app, I'd rather check how you'd prefer to handle it before opening a PR: whether to replace each std::cout call individually, route all output through a single wrapper, or something else entirely. Thanks!