Closed matthijskooijman closed 6 years ago
Thanks for reporting the bug @matthijskooijman Would you be able to create a pull request which addresses both the issues ? I think both are valid bugs.
If you are unable to do it, I will of course patch it.
Sorry, I really can't spare the time right now.
No problem. I have pushed the fix.
Thanks!
Looks good, thanks.
I tried reading output from stderr from a process, and it gets all messed up. It seems the length of the buffer returned is correct, but only the first couple of hundred bytes are filled, the rest are zeroes.
Looking at the code, it seems that
read_atmost_n
does not handle partial reads correctly. Changing this line to the following seems to fix this.On a related note, I suspect that if
read_all
resizes the buffer and causes arealloc
, then thebuffer
variable might become invalid.