Deadlock when using async input and pipes.
- Dominant language
- C++
- Stars
- 145
- Forks
- 151
- PR merge metrics
- No merged PRs in 30d
Description
Should this work, or is there a bug in what I'm doing? With the latest code on github, the following program hangs:
```
std::string data = "some data to send to cat";
std::future result;
boost::asio::io_service ios;
bp::pipe p;
bp::spawn("cat", bp::std_in < bp::buffer(data), bp::std_out > p, ios);
bp::spawn("cat", bp::std_in < p, bp::std_out > result, ios);
// run blocks forever.
ios.run();
std::cout << result.get() << std::endl;
```
This seems like something that ought to work. Also, these two other programs that are only a little different work as expected, making it seem like there might be a bug in the interaction between multiple processes participating in a pipeline and the use of async input:
```
// use echo to make data instead of bp::buffer()
std::future result;
boost::asio::io_service ios;
bp::pipe p1,p2;
bp::spawn("echo -n some data to send to cat", bp::std_out > p1);
bp::spawn("cat", bp::std_in < p1, bp::std_out > p2);
bp::spawn("cat", bp::std_in < p2, bp::std_out > result, ios);
ios.run();
std::cout << result.get() << std::endl;
```
```
// When pipes aren't used everything also works as expected.
std::string data = "some data to send to cat";
std::future result;
boost::asio::io_service ios;
bp::spawn("cat", bp::std_in < bp::buffer(data), bp::std_out > result, ios);
ios.run();
std::cout << result.get() << std::endl;
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.