mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-05 12:56:23 -04:00
19 lines
368 B
C++
Executable File
19 lines
368 B
C++
Executable File
#include <iostream>
|
|
#include "../subprocess.hpp"
|
|
|
|
using namespace subprocess;
|
|
|
|
void test_input()
|
|
{
|
|
auto p = Popen({"grep", "f"}, output{PIPE}, input{PIPE});
|
|
const char* msg = "one\two\three\four\five\n";
|
|
p.send(msg, strlen(msg));
|
|
auto res = p.communicate(nullptr, 0);
|
|
std::cout << res.first.data() << std::endl;
|
|
}
|
|
|
|
int main() {
|
|
test_input();
|
|
return 0;
|
|
}
|