java - Correct Usage of ProcessBuilder -
After researching, I have found that to use Java processbilders, the "right" way to test the two other threads The stdout / stderr of the newly created process to make, so that it is not shown here:
but it left me thinking about 2 questions - 1.) Why is the basic process stdout rising and then gradually stderr?
2.) In addition, if you redirect the stream to go both to the studio, then it will be acceptable to swad stdout only to the original process, and then to worry about deadlocks Do not need to?
Keep your words in mind.
-
Because the child can write both and when you have a buffer load for
stderr
(the child waits for the parentStderr
, waits for parents to closestdout
. -
if not the child's process to
stdin
is also needed, you should handlestdin
in your main thread and read the merged output stream through an extra thread and then It can be deadlock (child can wait) to read the output stream for parents and wait for the parent to read the data onstdin
.
Comments
Post a Comment