from the javadoc for java.lang.Process
:
The methods that create processes may not work well for special processes on certain native platforms, such as native windowing processes, daemon processes, Win16/DOS processes on Microsoft Windows, or shell scripts. The created subprocess does not have its own terminal or console. All its standard io (i.e. stdin, stdout, stderr) operations will be redirected to the parent process through three streams (getOutputStream(), getInputStream(), getErrorStream()). The parent process uses these streams to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.
I know about this issue, and of course it makes sense to communicate in a timely fashion with a subprocess if you are wanting to communicate with it.
But what if you just want to launch a process and don't care about the I/O? In Java is there a way to release the resources in the parent process that are dedicated towards managing the subprocess? (e.g. I/O pipes and waiting for the subprocess exit status)
If I execute the following in the parent process:
Process.getOutputStream().close();
Process.getInputStream().close();
Process.getErrorStream().close();
do I still have to worry about deadlock? (e.g. if the subprocess continuously sends out data to its own stdout)