Support output without delimiter, call write in loop#6
Support output without delimiter, call write in loop#6andrewthad wants to merge 2 commits intogoeb:masterfrom
Conversation
…g and check for errors.
|
I've confirmed that these changes work. |
|
Could you please give more context and details to clarify why the write() function was interrupted before writing all bytes? (does the mq process receive signals, ...) |
|
It doesn't receive any signals. I just thought it would be good for it to be correct in that case, but I can back that change out if you prefer. Or I could just change it to fail loudly if it doesn't write all the bytes on the first attempt. |
|
I agree with the no-delimiter option ('x'). Why didn't you apply it to the cmd_recv_follow() function ? But I do not agree with how you handle a hypothetical partial write. As we do not know what could cause a partial write, it is hard to handle it and avoid an infinite loop or a long blocking. I prefer the program to fail with an error message. For the naming of your variables, please use lower_case_with_underscore. |
The
recvsubcommand has a mistake that can cause it to truncate messages when outputting them. It ignores error codes and doesn't callwritein a loop to write out the entirety of the buffer. This PR fixes that mistake. Additionally, it adds support for a "no delimiter" option, selected with the characterx.I've not actually tested this yet, so don't merge this. I'm just planning on using this in a one-off script where the output is piped to
curl, and I noticed that the output would occasionally be wrong.