This commit is contained in:
parent
bbc280a50a
commit
d60b7364bc
@ -59,7 +59,13 @@ bool execute_local_command(const sCommand& command, bool silent, bool safe) {
|
||||
cStyle style = safe ? cStyle::Safe : cStyle::Raw;
|
||||
std::string full_cmd = command.construct_cmd(style) + " 2>&1" + (silent ? " > /dev/null" : "");
|
||||
int ret = system(full_cmd.c_str());
|
||||
return EXITSTATUSCHECK(ret);
|
||||
|
||||
bool ok = EXITSTATUSCHECK(ret);
|
||||
if (!ok) {
|
||||
std::cerr << "Error: Failed to execute command: " << std::endl;
|
||||
std::cerr << full_cmd << std::endl;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool execute_local_command_and_capture_output(const sCommand& command, std::string &output, bool silent, bool safe)
|
||||
@ -110,13 +116,7 @@ bool execute_ssh_command(const sSSHInfo &ssh_info, const sCommand &command, cMod
|
||||
ssh_cmd << "ssh -p " << ssh_info.port << " " << (mode & cMode::Interactive ? "-tt " : "")
|
||||
<< ssh_info.user << "@" << ssh_info.host;
|
||||
|
||||
std::string full_cmd = ssh_cmd.str() + " " + command.get_command_to_run();
|
||||
|
||||
sCommand ssh_command = {
|
||||
command.get_directory_to_run_in(),
|
||||
full_cmd,
|
||||
command.get_env_vars()
|
||||
};
|
||||
sCommand ssh_command(ssh_cmd.str() + " bash -c " + quote(escapequotes(command.construct_cmd(mode & cMode::SafeCommand ? cStyle::Safe : cStyle::Raw))));
|
||||
|
||||
bool rval = execute_local_command(ssh_command, mode, output);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user