This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: close I/O channels when a process ends
- From: David Daney <ddaney at avtrex dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: java-patches at gcc dot gnu dot org
- Date: Wed, 04 Aug 2004 10:58:09 -0700
- Subject: Re: Patch: close I/O channels when a process ends
- References: <16657.8751.625813.561989@cuddles.cambridge.redhat.com>
Andrew Haley wrote:
> I ran out of file handles. Was there any reason we weren't closing the
> files in Process.waitFor?
>
> Andrew.
>
>
> 2004-08-04 Andrew Haley <aph@redhat.com>
>
> * java/lang/natPosixProcess.cc (waitFor): Close I/O channels.
>
> Index: java/lang/natPosixProcess.cc
> ===================================================================
> RCS file: /cvs/gcc/gcc/libjava/java/lang/natPosixProcess.cc,v
> retrieving revision 1.18
> diff -c -2 -p -r1.18 natPosixProcess.cc
> *** java/lang/natPosixProcess.cc 1 Mar 2004 21:33:27 -0000 1.18
> --- java/lang/natPosixProcess.cc 4 Aug 2004 17:16:15 -0000
> *************** java::lang::ConcreteProcess::waitFor (vo
> *** 78,81 ****
> --- 78,105 ----
> }
>
> + try
> + {
> + inputStream->close ();
> + }
> + catch (java::io::IOException *e)
> + {
> + }
> +
> + try
> + {
> + outputStream->close ();
> + }
> + catch (java::io::IOException *e)
> + {
> + }
> +
> + try
> + {
> + errorStream->close ();
> + }
> + catch (java::io::IOException *e)
> + {
> + }
> +
> return status;
> }
Why?
David Daney.