Would be a pretty big rewrite of the pipes unit.
Yes. But, I am not going to do such a thing.
It seems that the
Tprocess.Input "output pipe stream" is missing something like, I would say, a "symmetrical" property that the
Tprocess.Output or
Tprocess.StdErr "input pipe streams" do have: Similar to the
NumBytesAvailable property (the number of bytes available for reading from the input pipe stream), we should have something like a
NumBytesAvailable property (the number of bytes available for writing to the output pipe stream
without the Write function blocking). This should be
0 when the pipe is
full and the
size of pipe when the called program has completely read everything from the pipe and waiting for more input.
Then, the calling program will be able to write as much as (but, not more than) the amount indicated in the
NumBytesAvailable property and will wait until some space is freed in the pipe before writing more. In such a scenario, it would be very easy to time out such an operation, if the called program does not read data from its input pipe for a certain amount of time.