Rewrite upgrade-simple to C++

This commit is contained in:
Vitaliy Filippov
2022-08-18 01:31:31 +03:00
parent a16263e88c
commit 40d8d65188
10 changed files with 217 additions and 147 deletions
+1 -2
View File
@@ -148,13 +148,12 @@ int shell_exec(const std::vector<std::string> & cmd, const std::string & in, std
close(child_stdout[1]);
close(child_stderr[0]);
close(child_stderr[1]);
//char *argv[] = { (char*)"/bin/sh", (char*)"-c", (char*)cmd.c_str(), NULL };
char *argv[cmd.size()+1];
for (int i = 0; i < cmd.size(); i++)
{
argv[i] = (char*)cmd[i].c_str();
}
argv[cmd.size()-1] = NULL;
argv[cmd.size()] = NULL;
execvp(argv[0], argv);
std::string full_cmd;
for (int i = 0; i < cmd.size(); i++)