我Boost Process在异步模式下使用来获取 shell 命令的stdout和stderr返回代码。在下面的代码片段中,是否c.wait()需要调用?根据Boost Process 1.68 文档,它不是必需的,而根据boost process 1.65.1.
std::string command = "ls";
boost::asio::io_service ios;
std::future<std::string> dataOut;
std::future<std::string> dataErr;
bp::child c(command, bp::std_in.close(), bp::std_out > dataOut, bp::std_err > dataErr, ios);
ios.run();
c.wait();
stdOut = dataOut.get();
stdErr = dataErr.get();
returnStatus = c.exit_code();
现在,我正在使用Boost 1.68,当我删除对 的调用时c.wait(),我得到一个returnStatusof而不是我添加调用时得到127的期望的。通话有什么不同?0c.wait()c.wait()