Patch: close I/O channels when a process ends
David Daney
ddaney@avtrex.com
Fri Aug 6 14:53:00 GMT 2004
I pressed send too soon :(.
David Daney wrote:
> Andrew Haley wrote:
>
>>
>>But we can still close the output channels here, can we?
>>
>
>
> Tom Tromey and I are saying that it might break something. There is
NO
> guarantee that what ever is reading from the inputStream and errorStream
> will have received all of the data before the thread that does the
> waitFor() closes the streams.
>
> I personally do not have code that does waitFor() before receiving EOF
> on the inputStream, so it would not break things for me. However I
> think that we have to assure that when a Process terminates cleanly we
> can read all the data and get an EOF indication.
>
> With your change if the waitFor() happens on a different thread, it is
> possible to miss some of the data and get an IOException instead.
> Further more it would depend on thread scheduling as to what would
> happen. I think non-deterministic behavior like this should be avoided
> when possible.
>
> David Daney.
>
More information about the Java-patches
mailing list