libutil: add setsid support to runProgram2
Change-Id: I9c023f2497cab12f1a7bfafd0baa82ffb5912d3e
This commit is contained in:
@@ -350,6 +350,9 @@ RunningProgram runProgram2(const RunOptions & options)
|
||||
/* Fork. */
|
||||
Pid pid{startProcess(
|
||||
[&]() {
|
||||
if (options.createSession && setsid() == -1) {
|
||||
throw SysError("setsid");
|
||||
}
|
||||
if (options.environment) {
|
||||
replaceEnv(*options.environment);
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ struct RunOptions
|
||||
std::optional<std::map<std::string, std::string>> environment = {};
|
||||
bool dieWithParent = true;
|
||||
bool captureStdout = false;
|
||||
bool createSession = false;
|
||||
std::vector<Redirection> redirections;
|
||||
#if __linux__
|
||||
std::set<long> caps;
|
||||
|
||||
Reference in New Issue
Block a user