diff --git a/src/utils/execute.cpp b/src/utils/execute.cpp index 5314517..7179b9d 100644 --- a/src/utils/execute.cpp +++ b/src/utils/execute.cpp @@ -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 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(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); diff --git a/templates/dropshell-agent/shared/_autocommands.sh b/templates/dropshell-agent/shared/_autocommands.sh index 49032ce..e697a57 100755 --- a/templates/dropshell-agent/shared/_autocommands.sh +++ b/templates/dropshell-agent/shared/_autocommands.sh @@ -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" "$@" } - -