Using a thread to capture process output

前端 未结 4 493
深忆病人
深忆病人 2020-12-06 22:11

I am using a thread to capture stream output from a process, and then outputting that stream to the eclipse console. The question I have is when to terminate the thread that

4条回答
  •  情深已故
    2020-12-06 22:56

    You can use VerboseProcess from jcabi-log (I'm a developer):

    String name = new VerboseProcess(
      new ProcessBuilder("executable with output")
    ).stdout();
    

    The only dependency you need:

    
      com.jcabi
      jcabi-log
      0.7.5
    
    

提交回复
热议问题