1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 10:31:15 +02:00

Use vfork

This commit is contained in:
Eelco Dolstra 2014-12-10 16:35:42 +01:00
parent b5ed5b6e66
commit 0e8fc118b3
3 changed files with 39 additions and 11 deletions

View file

@ -269,8 +269,16 @@ void killUser(uid_t uid);
/* Fork a process that runs the given function, and return the child
pid to the caller. */
pid_t startProcess(std::function<void()> fun, bool dieWithParent = true,
const string & errorPrefix = "error: ", bool runExitHandlers = false);
struct ProcessOptions
{
string errorPrefix;
bool dieWithParent;
bool runExitHandlers;
bool allowVfork;
ProcessOptions() : errorPrefix("error: "), dieWithParent(true), runExitHandlers(false), allowVfork(true) { };
};
pid_t startProcess(std::function<void()> fun, const ProcessOptions & options = ProcessOptions());
/* Run a program and return its stdout in a string (i.e., like the