communicate
Communicate with the process and wait for its termination.
If stdin is a pipe, input will be written to it. Afterwards, stdin will be closed to signal end-of-input.
If stdout or stderr are pipes, their output will be collected and returned on completion. The pipes will be closed on termination. The pipe collection runs in background threads to avoid buffer overflows in the pipe.
If a timeout is set, the child will be terminated if it doesn't finish soon enough. An extra timeout for graceful termination can be set, afterwards the child will be killed. The kill timeout can also be set to Duration.ZERO to skip the graceful termination attempt and kill the child directly.
Return
result of communication
Parameters
stdin pipe input. Ignored if stdin isn't a pipe
timeout for child process if desired
extra timeout before the terminated child is killed. May be ZERO to kill directly
Throws
if another process error occurs
if an IO error occurs in the pipes