StreamPumper should regularly flush OutputStream
guw opened this issue · comments
When running on Mac and connecting a process' standard in using ProcessExecutor.redirectInput(InputStream)
on Java 8 a process may not receive any data until the OutputStream
is flushed. The reason is that the launched process is a UNIXProcess
which wraps the OutputStream
for writing to a process' standard in into a BufferedOutputStream
.
Proposal: call out.flush()
immediately after writing any data to out
in StreamPumper.run
line 129.
Note, I have not verified this behavior on other platforms but according to this blog, Java seems to be doint it in general for anything using UNIXProcess
.
We can't do it always due to a performance hit but we should make it optional then.
Agreed. Do you want to always do it for the input?
Seems ok to do it for input. Thanks for the pull request. Changes look good.