cat never terminates when given an output stream
- Dominant language
- C++
- Stars
- 145
- Forks
- 151
- PR merge metrics
- No merged PRs in 30d
Description
When I call cat and attach bp::stdout (wether it be stdout or a pstream) the program hangs.
The following hopefully shows the problem.
```c++
#include
#include
#include
using namespace std;
namespace bp = boost::process;
int main(int argc, char **argv)
{
cout << boolalpha;
try
{
bp::opstream goodcat_in;
bp::child goodcat(bp::search_path("cat"), bp::std_in < goodcat_in);
goodcat_in << "foo" << endl;
goodcat_in.close();
cout << "Trying to wait for goodcat to finish" << endl;
goodcat.wait_for(std::chrono::seconds(3));
cout << "Is goodcat still running: " << goodcat.running() << endl;
bp::opstream badcat_in;
bp::child badcat(bp::search_path("cat"), bp::std_in stdout);
badcat_in << "foo" << endl;
badcat_in.close();
cout << "Trying to wait for badcat to finish" << endl;
badcat.wait_for(std::chrono::seconds(3));
cout << "Is badcat still running: " << badcat.running() << endl;
}
catch (bp::process_error &e)
{
cerr << "err " << e.what() << endl;
}
}
```
wandbox says both are still running (on a *nix): https://wandbox.org/permlink/4i8ZZik4f0dRjj0t
My local tests are on Windows10 on a cygwin shell (babun) and the builtin command prompt as well.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.