Closed BBO-repo closed 8 years ago
What compiler/OS are you using? I can't reproduce this issue with the following code:
/// @file outputter.cpp
#include <iostream>
int main()
{
std::cout << "unknown command\n;\n";
return 0;
}
/// @file tester.cpp
#include <iostream>
#include <string>
#include "process.h"
int main()
{
procxx::process p{"./outputter"};
p.exec();
std::string line;
while (std::getline(p.output(), line))
{
std::cout << line << std::endl;
}
return 0;
}
Using GCC 5.3.0 and Clang 3.7.1 (with libc++) both give me the expected output
unknown command
;
I'm using linux gcc 4.8.4 Effectively, with your example. I get all the content of the stdout of child process .. I'll continue my investigations. And really fan of the simplicity and compactness of your procxx Thanks for your reactivity.
I figured out where my problem was .. some of the output were written in std::cout whereas some other were in the std:cerr. Then std::cerr content is obtained with .... std::getline(p.error(), line) ......
Discussion could be closed. Thanks a lot for the time spent.
Let me know if you have any more issues/questions!
Hi,
Thanks a lot for the compact and efficient PROCXX. I nevertheless have a little problem getting all the line of the stdout from the child process I am using your procxx to make unit test of a command line interpreter that I've written. The problem I am dealing with is that some lines are missing. Ex: if stdout is the two lines "0\n" and ";\n", I effectively get the two line But if stdout is the tow lines "unknown command\n" and ";\n" I only get the last "\n"
Have you any suggestions to solve my problem.
Thanks.