mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
popen: add getter for pid
This commit is contained in:
parent
053ca037cb
commit
5c8e297319
2 changed files with 11 additions and 6 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue