|
|
@ -91,7 +91,7 @@ int spawn(const char *filename, const std::vector<std::string>& args, bool wait)
|
|
|
|
MINFO("Child exited with " << exitCode);
|
|
|
|
MINFO("Child exited with " << exitCode);
|
|
|
|
return static_cast<int>(exitCode);
|
|
|
|
return static_cast<int>(exitCode);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
char **argv = (char**)alloca(sizeof(char*) * (args.size() + 1));
|
|
|
|
std::vector<char*> argv(args.size() + 1);
|
|
|
|
for (size_t n = 0; n < args.size(); ++n)
|
|
|
|
for (size_t n = 0; n < args.size(); ++n)
|
|
|
|
argv[n] = (char*)args[n].c_str();
|
|
|
|
argv[n] = (char*)args[n].c_str();
|
|
|
|
argv[args.size()] = NULL;
|
|
|
|
argv[args.size()] = NULL;
|
|
|
@ -109,7 +109,7 @@ int spawn(const char *filename, const std::vector<std::string>& args, bool wait)
|
|
|
|
tools::closefrom(3);
|
|
|
|
tools::closefrom(3);
|
|
|
|
close(0);
|
|
|
|
close(0);
|
|
|
|
char *envp[] = {NULL};
|
|
|
|
char *envp[] = {NULL};
|
|
|
|
execve(filename, argv, envp);
|
|
|
|
execve(filename, argv.data(), envp);
|
|
|
|
MERROR("Failed to execve: " << strerror(errno));
|
|
|
|
MERROR("Failed to execve: " << strerror(errno));
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|