Commit b18132e5 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼

popen: add getter for pid

parent da710c8e
......@@ -48,21 +48,26 @@ public:
int close();
void kill(int signal = SIGINT);
std::istream &in()
std::istream &cin()
{
return *(input.stream);
}
std::ostream &out()
std::ostream &cout()
{
return *(output.stream);
}
int fd()
int getFd()
{
return input.buffer->fd();
}
pid_t getPid() const
{
return pid;
}
protected:
std::string command;
pid_t pid;
......
......@@ -33,12 +33,12 @@ Test(popen, cat)
{
Popen proc("cat");
proc.out() << "Hello World" << std::endl;
proc.out().flush();
proc.cout() << "Hello World" << std::endl;
proc.cout().flush();
std::string str, str2;
proc.in() >> str >> str2;
proc.cin() >> str >> str2;
cr_assert_eq(str, "Hello");
cr_assert_eq(str2, "World");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment