How to ensure that we read all lines from boost::child process

前端 未结 3 654
南方客
南方客 2021-02-08 21:16

I saw the following code on boost::child documentation page where they explain how to read the output of a child process. http://www.boost.org/doc/libs/1_64_0/doc/h

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-08 21:45

    Another solution.

    bp::child c(bp::search_path("nm"), file, bp::std_out > output, bp::std_err > error, svc);
    

    This code ignores the order of stdout/stderr. If the order concerns, you can write like this:

    bp::child c(bp::search_path("nm"), file, (bp::std_out & bp::std_err) > outerr, svc);
    

提交回复
热议问题