Something wrong with the ssh commands./
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 21s

This commit is contained in:
Your Name 2025-05-11 21:45:23 +12:00
parent df03f5ef91
commit 23e3d731c9
2 changed files with 8 additions and 7 deletions

View File

@ -121,7 +121,7 @@ sCommand server_env_manager::construct_standard_template_run_cmd(const std::stri
argstr += " " + quote(dequote(trim(arg))); argstr += " " + quote(dequote(trim(arg)));
} }
sCommand scommand(remote_service_template_path, "bash " + quote(script_path) + argstr + (silent ? " > /dev/null 2>&1" : ""), env_vars); sCommand scommand(remote_service_template_path, quote(script_path) + argstr + (silent ? " > /dev/null 2>&1" : ""), env_vars);
if (scommand.empty()) if (scommand.empty())
std::cerr << "Error: Failed to construct command for " << service_name << " " << command << std::endl; std::cerr << "Error: Failed to construct command for " << service_name << " " << command << std::endl;

View File

@ -110,8 +110,6 @@ bool execute_ssh_command(const sSSHInfo &ssh_info, const sCommand &command, cMod
<< ssh_info.user << "@" << ssh_info.host; << ssh_info.user << "@" << ssh_info.host;
std::string cmdstr = command.construct_cmd(is_raw(mode) ? cStyle::Raw : cStyle::Safe); std::string cmdstr = command.construct_cmd(is_raw(mode) ? cStyle::Raw : cStyle::Safe);
ASSERT(cmdstr.find("'") == std::string::npos, "Raw command must not contain single quotes: " + cmdstr);
cmdstr = "bash -c " + halfquote(cmdstr);
sCommand ssh_command(ssh_cmd.str() + " " + cmdstr); sCommand ssh_command(ssh_cmd.str() + " " + cmdstr);
cMode localmode = mode + cMode::RawCommand; cMode localmode = mode + cMode::RawCommand;
@ -141,15 +139,18 @@ std::string sCommand::construct_cmd(cStyle style) const
return ""; return "";
std::string cmdstr; std::string cmdstr;
if (!mDir.empty())
cmdstr = "cd " + quote(mDir) + " && ";
for (const auto& env_var : mVars) { for (const auto& env_var : mVars) {
cmdstr += env_var.first + "=" + quote(dequote(trim(env_var.second))) + " "; cmdstr += env_var.first + "=" + quote(dequote(trim(env_var.second))) + " ";
} }
cmdstr += "bash -c '";
if (!mDir.empty())
cmdstr += "cd " + quote(mDir) + " && ";
cmdstr += mCmd; cmdstr += mCmd;
cmdstr += "'";
if (is_safe(style)) if (is_safe(style))
cmdstr = makesafecmd(cmdstr); cmdstr = makesafecmd(cmdstr);