On 03/24/2014 10:11 PM, roger riggs wrote:
From the scope of the JEP, a fairly simple API seems sufficient.
- Enumerate the direct children
- The rest of the functions are similar to Process
- to terminate a process, forcibly and normally
- to destroy a process and all of its children recursively
- to check if one is alive
- to waitFor for termination and retrieve the exit status
On Linux, I think you need to use obscure mechanisms to make this
iteration reliable (cgroups perhaps). There is no openpid() or similar
mechanism that allows you to obtain a stable handle.
Somewhat relatedly, it would make sense to make Process auto-closeable,
so that you can make sure that no non-Java resources are retained.
Right now, this seems to require calling destroyForcibly().waitFor().
It would be nice if there was a way to directly pipe the output of one
process to the input of another process. I think that even with Java 8,
this still needs an explicit copy loop.
--
Florian Weimer / Red Hat Product Security Team