I have a CreateProcess which has the output redirected to a named pipe. The other end of the named is being read by a 2 threads, one for stdout and one for stderr. The data comes through okay, but mostly in chunks of 1024. The problem is that I need to get the data right away and don't want to wait for 1024 bytes before it is sent.
I have tried:
- changing the size of the buffer set in CreateNamedPipe to small values.
- Setting the flags in createFile for the write end of the named pipe to FILE_FLAG_WRITE_THROUGH |FILE_FLAG_NO_BUFFERING before they get passed to the subprocess
- Using overlapped file handles
- Using Anonymous Pipes
- Banging my head against the wall.
But I can't seem to get any data over the pipe before 1024 or before the app ends.
Is there anyway to flush the named pipe on the read end to get anything that has been written to the write end but is being held in a buffer... or disable the buffers?