Simplify interactive
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 21s

This commit is contained in:
Your Name 2025-05-10 22:27:51 +12:00
parent ed68b58e5c
commit d1d880a3a8
2 changed files with 3 additions and 18 deletions

View File

@ -31,20 +31,8 @@ bool execute_local_command_interactive(const sCommand &command, bool silent)
perror("fork failed");
return false;
} else if (pid == 0) {
// Child process
ASSERT(full_command.find("'") == std::string::npos, "Raw command must not contain single quotes");
std::vector<const char *> commandvec = {"bash", "-c", halfquote(full_command).c_str(),NULL};
if (!silent) {
std::cout << "Executing command: ";
for (auto & x : commandvec) std::cout << x << " ";
std::cout << std::endl;
}
execvp(commandvec[0], const_cast<char* const*>(commandvec.data()));
// If execvp returns, it means an error occurred
perror("execvp failed");
exit(EXIT_FAILURE); // Exit child process on error
int rval = system(full_command.c_str());
exit(rval);
} else {
// Parent process
int ret;
@ -123,7 +111,7 @@ bool execute_ssh_command(const sSSHInfo &ssh_info, const sCommand &command, cMod
<< ssh_info.user << "@" << ssh_info.host;
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");
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);

View File

@ -5,7 +5,6 @@
MYID=$(id -u)
MYGRP=$(id -g)
_autocommandrun_volume() {
local command="$1"
local volume_name="$2"
@ -188,5 +187,3 @@ autorestore() {
_autocommandparse restore "$BACKUP_TEMP_PATH" "$@"
}