Create Popen::communicate overload for std::string (#82)

* Create Popen::communicate overload for std::string

* Create Popen::send overload for std::string
This commit is contained in:
Mikhail Sokolovskiy 2022-06-25 18:20:38 +03:00 committed by GitHub
parent cbc9e82158
commit 1392c47cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1288,6 +1288,9 @@ public:
int send(const char* msg, size_t length)
{ return stream_.send(msg, length); }
int send(const std::string& msg)
{ return send(msg.c_str(), msg.size()); }
int send(const std::vector<char>& msg)
{ return stream_.send(msg); }
@ -1298,6 +1301,11 @@ public:
return res;
}
std::pair<OutBuffer, ErrBuffer> communicate(const std::string& msg)
{
return communicate(msg.c_str(), msg.size());
}
std::pair<OutBuffer, ErrBuffer> communicate(const std::vector<char>& msg)
{
auto res = stream_.communicate(msg);