PATCH: waitpid in natPosixProcess.cc
Andrew Haley
aph@redhat.com
Wed Apr 21 10:37:00 GMT 2004
Casey Marshall writes:
> Attached is a simple patch that invokes waitpid if either the process
> is destroy()ed or the C call to exec() fails.
>
> This prevents Runtime.exec from spawning zombie processes if the given
> command cannot be found, or if the process is killed. I wasn't sure if
> it was appropriate to call waitFor instead, but (AFAIK) calling
> waitpid in these two spots is safe.
I think this is probably wrong, because you don't set hasExited in the
Process. With this patch, a subsequent call to Process::destroy will
cause some other process that coincidentally has the same PID to be
killed.
Andrew.
More information about the Java-patches
mailing list