This commit is contained in:
parent
ed68b58e5c
commit
d1d880a3a8
@ -31,20 +31,8 @@ bool execute_local_command_interactive(const sCommand &command, bool silent)
|
|||||||
perror("fork failed");
|
perror("fork failed");
|
||||||
return false;
|
return false;
|
||||||
} else if (pid == 0) {
|
} else if (pid == 0) {
|
||||||
// Child process
|
int rval = system(full_command.c_str());
|
||||||
ASSERT(full_command.find("'") == std::string::npos, "Raw command must not contain single quotes");
|
exit(rval);
|
||||||
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
|
|
||||||
} else {
|
} else {
|
||||||
// Parent process
|
// Parent process
|
||||||
int ret;
|
int ret;
|
||||||
@ -123,7 +111,7 @@ 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");
|
ASSERT(cmdstr.find("'") == std::string::npos, "Raw command must not contain single quotes: " + cmdstr);
|
||||||
cmdstr = "bash -c " + halfquote(cmdstr);
|
cmdstr = "bash -c " + halfquote(cmdstr);
|
||||||
sCommand ssh_command(ssh_cmd.str() + " " + cmdstr);
|
sCommand ssh_command(ssh_cmd.str() + " " + cmdstr);
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
MYID=$(id -u)
|
MYID=$(id -u)
|
||||||
MYGRP=$(id -g)
|
MYGRP=$(id -g)
|
||||||
|
|
||||||
|
|
||||||
_autocommandrun_volume() {
|
_autocommandrun_volume() {
|
||||||
local command="$1"
|
local command="$1"
|
||||||
local volume_name="$2"
|
local volume_name="$2"
|
||||||
@ -188,5 +187,3 @@ autorestore() {
|
|||||||
|
|
||||||
_autocommandparse restore "$BACKUP_TEMP_PATH" "$@"
|
_autocommandparse restore "$BACKUP_TEMP_PATH" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user