Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.6
-
Fix Version/s: 2.1.0-rc-1
-
Component/s: groovy-jdk
-
Labels:None
-
Number of attachments :
Description
Java doesn't close streams until finalization which can result in too many open files errors sometimes. To avoid this problem, one needs to proactively close all the streams of a Process when it is finished. This currently requires 3 method calls so I propose a simple one be added to Process called closeStreams() instead.
I should probably clarify that you can also use waitForProcessOutput() but that's not always sufficient, such as when you would like to process the output as it is generated. In these cases, closeStreams() also needs to join the consumed threads if there are any.