ChildProcess read is using buffering fread and hangs constantly

i’ve noticed that if you spawn a process which produces a lot of output and print that via read, it buffers because we are using fread and it freezes in the console quite constantly:

auto numBytesRead = (int) fread (dest, 1, (size_t) numBytes, readHandle);

Changing it to non buffering read:

auto numBytesRead = (int) ::read (pipeHandle, dest, (size_t) numBytes);

now the output is instant and there are no freezes or slowing downs.