Java Process with Input/Output Stream

后端 未结 3 1435
我在风中等你
我在风中等你 2020-11-22 01:23

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

3条回答
  •  天涯浪人
    2020-11-22 02:12

    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.

提交回复
热议问题