Am 07.08.2016 um 13:08 schrieb Antony Polukhin:
Btw: i recommend to use the asio functionality, that works much better. I'm already using that myself, did not run into any problems.
I'd like to have a non ASIO version working out of the box. ASIO is an overkill in such simple cases.
Well, it does work out of the box. Problem is: the pipe is not closed automatically, so you might get a deadlock if you're trying to read after the program has exited. Reason is: on posix you can set a flag to close a pipe when the child exits. On windows you cannot, you'd have to close the sink on the launching process so that only the launched process has a handle to it. BUT, when I use an named pipe it is essentially a file-handle. With that, it does not work at all. So in order to keep this consistent, the pipe will not be closed on child exit. That can cause a deadlock Now if you know how the output looks, you can use it. If you don't, well, you'll probably get a deadlock. In the case of the example: 'nm ' appends an empty line at the end, so I'd need to check for that, i.e.: while (c.running() && std::getline(is, line) && (line.size() > 0)) {...} I'll fix the documentation soon.