CASM
AClustersApproachtoStatisticalMechanics
|
#include <Popen.hh>
Public Member Functions | |
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. More... | |
void | popen (std::string _command) |
Execute popen for a given command. More... | |
std::string | gets () const |
Returns the stdout resulting from the last popen call. More... | |
void | print (std::ostream &sout) const |
Print the last command executed and the resulting stdout. More... | |
int | exit_code () const |
Returns pclose(fp)/256. More... | |
Static Public Member Functions | |
static void | default_popen_handler (FILE *fp) |
Default popen error handler throws std::runtime_error if popen failed. More... | |
static void | default_pclose_handler (int status) |
Default pclose error handler throws std::runtime_error if pclose failed. More... | |
Private Attributes | |
std::string | m_command |
std::string | m_stdout |
int | m_pclose_result |
std::function< void(FILE *)> | m_popen_handler |
std::function< void(int)> | m_pclose_handler |
bool | m_combine_stdout_stderr |
CASM::Popen::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 |
||
) |
|
static |
|
static |
int CASM::Popen::exit_code | ( | ) | const |
std::string CASM::Popen::gets | ( | ) | const |
void CASM::Popen::popen | ( | std::string | _command | ) |
void CASM::Popen::print | ( | std::ostream & | sout | ) | const |
|
private |
|
private |