libutil: add setsid support to runProgram2

Change-Id: I9c023f2497cab12f1a7bfafd0baa82ffb5912d3e
This commit is contained in:
eldritch horrors
2026-01-19 19:28:46 +01:00
parent 6c7a80e449
commit 39869c8b35
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -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);
}
+1
View File
@@ -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;