43 lines
1.2 KiB
Markdown
43 lines
1.2 KiB
Markdown
# Runner
|
|
|
|
Simple c++ demonstration program of the dropshell runner library.
|
|
|
|
use:
|
|
runner
|
|
|
|
|
|
The exit code is that of the command run, or -1 if the command couldn't be run.
|
|
|
|
|
|
|
|
The c++ library used, which is contained in this codebase, has one simple function:
|
|
|
|
typedef struct sSSHInfo {
|
|
std::string host;
|
|
std::string user;
|
|
std::string port;
|
|
} sSSHInfo;
|
|
|
|
|
|
static 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,
|
|
bool silent,
|
|
bool interactive,
|
|
sSSHInfo * sshinfo = nullptr,
|
|
std::string* output = nullptr,
|
|
);
|
|
|
|
|
|
If SSH information is provided, the command will be executed on the remote server. Otherwise on the local machine.
|
|
|
|
If output is provided, the output of the command is captured.
|
|
|
|
If interactive is true, then an interactive session is created - e.g. for running nano to remotely edit a file, or sshing into a docker container from the remote host.
|
|
|
|
If silent is true, then all output is suppressed.
|
|
|
|
Before the command is run, the current directory is changed to working_dir on the remote host (or local host if no ssh info provided).
|