typedef struct ExecResult ExecResult;
std::string capture_exec(const std::string& command, ExecResult &rescode);
-std::string capture_exec(const char *const *command, ExecResult &rescode);
-std::string capture_exec(const std::vector<std::string>& command, ExecResult &rescode);
+std::string capture_exec(const char *const *command, ExecResult &rescode,
+ const bool out=true, const bool err=false);
+std::string capture_exec(const std::vector<std::string>& command, ExecResult &rescode,
+ const bool out=true, const bool err=false);
inline std::string capture_exec (const std::string &command)
{
int *exit_status;
public:
- inpipebuf(const std::string& command);
- inpipebuf(const char *const *command);
- inpipebuf(const std::vector<std::string> &command);
+ inpipebuf(const std::string& command,
+ const bool out, const bool err);
+ inpipebuf(const char *const *command,
+ const bool out, const bool err);
+ inpipebuf(const std::vector<std::string> &command,
+ const bool out, const bool err);
~inpipebuf();
virtual int_type underflow();
private:
- FILE *init_without_shell (const char *const *argv) const;
+ FILE *init_without_shell (const char *const *argv,
+ const bool out, const bool err) const;
};
/** @brief stream around inpipebuf -- see comment there */
inpipebuf buf;
public:
- inpipestream(const std::string& command)
- : std::istream(&buf), buf(command)
+ inpipestream(const std::string& command,
+ const bool out=true, const bool err=false)
+ : std::istream(&buf), buf(command, out, err)
{}
- inpipestream(const char *const command[])
- : std::istream(&buf), buf(command)
+
+ inpipestream(const char *const command[],
+ const bool out=true, const bool err=false)
+ : std::istream(&buf), buf(command, out, err)
{}
- inpipestream(const std::vector<std::string> &command)
- : std::istream(&buf), buf(command)
+ inpipestream(const std::vector<std::string> &command,
+ const bool out=true, const bool err=false)
+ : std::istream(&buf), buf(command, out, err)
{}
void store_exit_status(bool *_status_set, int *_exit_status)