Why does process hang if the parent does not consume stdout/stderr in Java?
问题 I know that if you use ProcessBuilder.start in Java to start an external process you have to consume its stdout/stderr (e.g. see here). Otherwise the external process hangs on start. My question is why it works this way. My guess is that JVM redirects stdout/stderr of the executed process to pipes and if the pipes have no room the writes to the pipes block. Does it make sense? Now I wonder why Java does it way. What is the rationale behind this design? 回答1: Java doesn't do anything in this