How to reproduce deadlock hinted to by Boost process documentation?
问题 According to the Boost documentation (section 'Why does the pipe not close?'), the following code will result in a deadlock: #include <boost/process.hpp> #include <iostream> namespace bp = ::boost::process; int main(void) { bp::ipstream is; bp::child c("ls", bp::std_out > is); std::string line; while (std::getline(is, line)) { std::cout << line << "\n"; } return 0; } The documentation says: This will also deadlock, because the pipe does not close when the subprocess exits. So the ipstream