I have the following code example below. Whereby you can enter a command to the bash shell i.e. echo test and have the result echo\'d back. However, after the f
You have writer.close(); in your code. So bash receives EOF on its stdin and exits. Then you get Broken pipe when trying to read from the stdoutof the defunct bash.