asio
asio copied to clipboard
Inconsistent Return of readable_pipe on Windows
Currently, on Windows, readable_pipe returns ERROR_BROKEN_PIPE instead of error::misc_errors::eof. This behavior is inconsistent with other platforms.
Could you provide a code sample with this error?
Could you provide a code sample with this error?
int main()
{
asio::io_context ioc;
asio::readable_pipe pipei{ioc};
asio::writable_pipe pipeo{ioc};
asio::connect_pipe(pipei, pipeo);
pipeo.write_some(asio::buffer(".", 1));
pipeo.close();
char buf[1];
pipei.read_some(asio::buffer(buf));
std::cout << buf[0] << std::endl;
try {
pipei.read_some(asio::buffer(buf));
} catch (const std::exception& e) {
std::cout << e.what() << std::endl;
}
}