From 1392c47cbbf519bd02ddafb5871526c16b7f2dd1 Mon Sep 17 00:00:00 2001 From: Mikhail Sokolovskiy Date: Sat, 25 Jun 2022 18:20:38 +0300 Subject: [PATCH] Create Popen::communicate overload for std::string (#82) * Create Popen::communicate overload for std::string * Create Popen::send overload for std::string --- subprocess.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subprocess.hpp b/subprocess.hpp index 8ebac01..aaed3c7 100755 --- a/subprocess.hpp +++ b/subprocess.hpp @@ -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& msg) { return stream_.send(msg); } @@ -1298,6 +1301,11 @@ public: return res; } + std::pair communicate(const std::string& msg) + { + return communicate(msg.c_str(), msg.size()); + } + std::pair communicate(const std::vector& msg) { auto res = stream_.communicate(msg);