(java)ProcessBuilder的inheritIO

ProcessBuilder里面有一个inheritIO()方法:

使用上面的方法可以让命令的::输出::直接输出给本::Java Process::。撰写代码例子如下:

执行上面的代码,可以看到ls命令的输出直接到了console里面:

也就是说ls的输出直接转给了这个::java process::。

上面的样例代码在这里:

My Github Page: https://github.com/liweinan

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here:
https://github.com/liweinan/liweinan.github.io/issues