Even GC.start does not guarantee that the garbage collection will be
actually started, it is just a hint after all. And I am not sure that
even when an IO object is being garbage collected, there will be an
implicit call to close(). I personally would not expect it as no
finalizers are installed by default.
So the programmer must take care to write the correct code, short or
long ;-).
Even if GC.start helped in your case, the overall code would be longer
(because of calls to GC.start) and work much worse (as GC does a lot
that you may not need for the moment) than what I have suggested. And
using blocks with popen is GUARANTEED to close descriptors properly. See
my point?
By the way, you are welcome.
Gennady.