19 bool _combine_stdout_stderr =
true);
22 void popen(std::string _command);
25 std::string
gets()
const;
28 void print(std::ostream &sout)
const;
Remember how to use popen.
std::string gets() const
Returns the stdout resulting from the last popen call.
Popen(std::function< void(FILE *)> _popen_handler=Popen::default_popen_handler, std::function< void(int)> _pclose_handler=Popen::default_pclose_handler, bool _combine_stdout_stderr=true)
Construct a Popen object.
static void default_pclose_handler(int status)
Default pclose error handler throws std::runtime_error if pclose failed.
void popen(std::string _command)
Execute popen for a given command.
void print(std::ostream &sout) const
Print the last command executed and the resulting stdout.
std::function< void(int)> m_pclose_handler
int exit_code() const
Returns pclose(fp)/256.
static void default_popen_handler(FILE *fp)
Default popen error handler throws std::runtime_error if popen failed.
std::function< void(FILE *)> m_popen_handler
bool m_combine_stdout_stderr