mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
popen: add getter for pid
This commit is contained in:
parent
7d10faf76f
commit
ca1e944fce
2 changed files with 11 additions and 6 deletions
|
@ -48,21 +48,26 @@ public:
|
||||||
int close();
|
int close();
|
||||||
void kill(int signal = SIGINT);
|
void kill(int signal = SIGINT);
|
||||||
|
|
||||||
std::istream &in()
|
std::istream &cin()
|
||||||
{
|
{
|
||||||
return *(input.stream);
|
return *(input.stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &out()
|
std::ostream &cout()
|
||||||
{
|
{
|
||||||
return *(output.stream);
|
return *(output.stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd()
|
int getFd()
|
||||||
{
|
{
|
||||||
return input.buffer->fd();
|
return input.buffer->fd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pid_t getPid() const
|
||||||
|
{
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string command;
|
std::string command;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
|
@ -33,12 +33,12 @@ Test(popen, cat)
|
||||||
{
|
{
|
||||||
Popen proc("cat");
|
Popen proc("cat");
|
||||||
|
|
||||||
proc.out() << "Hello World" << std::endl;
|
proc.cout() << "Hello World" << std::endl;
|
||||||
proc.out().flush();
|
proc.cout().flush();
|
||||||
|
|
||||||
std::string str, str2;
|
std::string str, str2;
|
||||||
|
|
||||||
proc.in() >> str >> str2;
|
proc.cin() >> str >> str2;
|
||||||
|
|
||||||
cr_assert_eq(str, "Hello");
|
cr_assert_eq(str, "Hello");
|
||||||
cr_assert_eq(str2, "World");
|
cr_assert_eq(str2, "World");
|
||||||
|
|
Loading…
Add table
Reference in a new issue