This commit is contained in:
John 2025-04-27 11:57:42 +12:00
parent 898cc97bae
commit d5c7dc7de6

View File

@ -64,7 +64,7 @@ std::string server_env::get_variable(const std::string& name) const {
std::string server_env::construct_ssh_cmd() const { std::string server_env::construct_ssh_cmd() const {
std::stringstream ssh_cmd; std::stringstream ssh_cmd;
ssh_cmd << "ssh -p " << get_SSH_PORT() << " " ssh_cmd << "ssh -p " << get_SSH_PORT() << " "
<< get_SSH_USER() << "@" << get_SSH_HOST() << " "; << get_SSH_USER() << "@" << get_SSH_HOST();
return ssh_cmd.str(); return ssh_cmd.str();
} }
@ -123,7 +123,7 @@ bool server_env::check_remote_items_exist(const std::vector<std::string> &file_p
} }
bool server_env::execute_ssh_command(const sCommand& command) const { bool server_env::execute_ssh_command(const sCommand& command) const {
std::string full_cmd = construct_ssh_cmd() + quote(command.construct_safecmd()); std::string full_cmd = construct_ssh_cmd() + " " + quote(command.construct_safecmd());
bool okay = execute_local_command(full_cmd); bool okay = execute_local_command(full_cmd);
if (!okay) { if (!okay) {
std::cerr << "Error: Failed to execute command on remote server: " << full_cmd << std::endl; std::cerr << "Error: Failed to execute command on remote server: " << full_cmd << std::endl;
@ -133,7 +133,7 @@ bool server_env::execute_ssh_command(const sCommand& command) const {
bool server_env::execute_ssh_command_and_capture_output(const sCommand& command, std::string &output) const bool server_env::execute_ssh_command_and_capture_output(const sCommand& command, std::string &output) const
{ {
std::string full_cmd = construct_ssh_cmd() + quote(command.construct_safecmd()); std::string full_cmd = construct_ssh_cmd() + " " + quote(command.construct_safecmd());
bool okay = execute_local_command_and_capture_output(full_cmd, output); bool okay = execute_local_command_and_capture_output(full_cmd, output);
if (!okay) { if (!okay) {
std::cerr << "Error: Failed to execute command on remote server: " << full_cmd << std::endl; std::cerr << "Error: Failed to execute command on remote server: " << full_cmd << std::endl;