mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-06 05:16:24 -04:00
New test file
This commit is contained in:
parent
2224a2802c
commit
7260f1a358
20
test/test_subprocess.cc
Executable file
20
test/test_subprocess.cc
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include "../subprocess.hpp"
|
||||||
|
|
||||||
|
using namespace subprocess;
|
||||||
|
|
||||||
|
void test_input()
|
||||||
|
{
|
||||||
|
auto p = Popen({"grep", "f"}, output{PIPE}, input{PIPE});
|
||||||
|
const char* msg = "one\ntwo\nfour\n";
|
||||||
|
std::fwrite(msg, 1, strlen(msg), p.input());
|
||||||
|
fclose (p.input());
|
||||||
|
|
||||||
|
std::vector<uint8_t> rbuf(128);
|
||||||
|
std::fread(rbuf.data(), 1, 128, p.output());
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
test_input();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user