diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-12-10T15·35+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-12-10T16·25+0100 |
commit | 0e8fc118b3d2d3bb6f9b0a918bf8ceb3927774cd (patch) | |
tree | 5f022418fc293841c649dceacd26e88e8a464c57 /src/libutil/util.hh | |
parent | b5ed5b6e666e9d1e23b7cbc815684bfef52c3d41 (diff) |
Use vfork
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r-- | src/libutil/util.hh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 628b8a0e1f09..09eb4d6e2b5e 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -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 |