dropshell/src/utils/runner.hpp
Your Name 61218f8866
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 21s
colour
2025-05-10 16:56:54 +12:00

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