Correct Usage of ProcessBuilder

此生再无相见时 提交于 2019-12-05 19:34:31

Mind your terms. Threads aren't processes.

  1. Because the child could write to both and you would get a deadlock when the buffer for stderr is full (child waits for parent to read stderr, parent waits for child to close stdout).

  2. No. If the child process also needs stdin, then you must handle stdin in your main thread and read the merged output streams via an extra thread or you could have deadlocks again (child waits for parent to read the output stream and the parent waits for the child to read the data on stdin).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!