40 lines
936 B
C++
40 lines
936 B
C++
#ifndef RUNNER_HPP
|
|
#define RUNNER_HPP
|
|
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
namespace runner {
|
|
|
|
struct sSSHInfo {
|
|
std::string host;
|
|
std::string user;
|
|
std::string port;
|
|
};
|
|
|
|
class copySSHPtr {
|
|
public:
|
|
copySSHPtr(const sSSHInfo* sshinfo) : mSSHInfo(sshinfo ? *sshinfo : sSSHInfo()) {}
|
|
copySSHPtr(const sSSHInfo& sshinfo) : mSSHInfo(sshinfo) {}
|
|
bool valid() const { return !mSSHInfo.host.empty(); }
|
|
const sSSHInfo * operator&() const { return (valid() ? &mSSHInfo : nullptr); }
|
|
private:
|
|
sSSHInfo mSSHInfo;
|
|
};
|
|
|
|
int execute_cmd(
|
|
const std::string& command,
|
|
const std::vector<std::string>& args,
|
|
const std::string& working_dir,
|
|
const std::map<std::string, std::string>& env,
|
|
const bool silent,
|
|
const bool interactive,
|
|
const copySSHPtr& sshinfo = nullptr,
|
|
std::string* output = nullptr
|
|
);
|
|
|
|
} // namespace runner
|
|
|
|
#endif // RUNNER_HPP
|