Update source/src/commands/ssh.cpp
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 34s
Build-Test-Publish / build (linux/arm64) (push) Successful in 1m3s

This commit is contained in:
Your Name
2025-08-23 18:44:18 +12:00
parent 881d4e1642
commit 66fdfb1e31

View File

@@ -2,6 +2,7 @@
#include "config.hpp"
#include "utils/utils.hpp"
#include "utils/directories.hpp"
#include "utils/execute.hpp"
#include "shared_commands.hpp"
#include "servers.hpp"
#include "services.hpp"
@@ -48,7 +49,12 @@ namespace dropshell
error << "Server " << server << " is not valid" << std::endl;
return false;
}
execute_ssh_command(server_env.get_SSH_INFO(user), sCommand(remotepath(server, user).DROPSHELL_DIR(), "ls --color && bash", {}), cMode::Interactive);
std::string dropshell_dir = remotepath(server, user).DROPSHELL_DIR();
std::string bash_cmd = "ls --color && exec bash --rcfile <(cat ~/.bashrc 2>/dev/null; echo 'cd " + quote(dropshell_dir) + "')";
info << "SSHing into " << server << ":" << dropshell_dir << " as user " << user << std::endl;
execute_ssh_command(server_env.get_SSH_INFO(user), sCommand(dropshell_dir, bash_cmd, {}), cMode::Interactive);
return true;
}