in reply to Re^2: How to autoflush streams (i.e. open3 calls)
in thread [UPDATED] How to autoflush streams (i.e. open3 calls)
The actual problem probably is that when the parent goes to read, the children has already finished and all the data is awaiting on the pipes buffers. The parent reads then first all the data from child STDOUT and then the data from child STDERR.
AFAIK there is no way to synchronize child writes with parent reads.
If you really need to know the order in with data is printed, use the same pipe for STDOUT and STDERR and preppend every line with a channel identifier so you can demultiplex it on the parent process.
|
|---|