34 const std::vector<std::string>& argv,
35 const std::map<std::string, std::string>& env,
40 char** it;
char** pargv;
char** penv;
41 it = pargv =
new char*[argv.size()+2];
42 *it = ::strdup(fn.c_str());
44 for (
auto element : argv)
46 *it = ::strdup(element.c_str());
51 it = penv =
new char*[env.size()+1];
54 *it = ::strdup((pair.first +
"=" + pair.second).c_str());
Status
The Status enum wrap's the posix exit status.
StandardStream
The StandardStream enum wraps the POSIX standard streams.
CORE_POSIX_DLL_PUBLIC ChildProcess fork(const std::function< posix::exit::Status()> &main, const StandardStream &flags)
fork forks a new process and executes the provided main function in the newly forked process...
CORE_POSIX_DLL_PUBLIC ChildProcess exec(const std::string &fn, const std::vector< std::string > &argv, const std::map< std::string, std::string > &env, const StandardStream &flags)
exec execve's the executable with the provided arguments and environment.
The Process class models a child process of this process.