libutil: return pid object from RunningProgram::release

returning the pid as a pid_t instead of as a Pid raii wrapper is only
convenient for daemon use (where it'll eventually go away). using the
released pid correctly in other places is harder without the wrapper.

Change-Id: Ib42a2f357d2f0849beabd015b321bfff31334eda
This commit is contained in:
eldritch horrors
2026-01-19 19:28:46 +01:00
parent 7d764670c8
commit 1719d60531
3 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -306,9 +306,9 @@ RunningProgram::~RunningProgram()
}
}
std::tuple<pid_t, std::unique_ptr<AsyncFdIoStream>> RunningProgram::release()
std::tuple<Pid, std::unique_ptr<AsyncFdIoStream>> RunningProgram::release()
{
return {pid.release(), std::move(childStdout)};
return {std::move(pid), std::move(childStdout)};
}
int RunningProgram::kill()
+1 -1
View File
@@ -121,7 +121,7 @@ public:
explicit operator bool() const { return bool(pid); }
std::tuple<pid_t, std::unique_ptr<AsyncFdIoStream>> release();
std::tuple<Pid, std::unique_ptr<AsyncFdIoStream>> release();
int kill();
[[nodiscard]]
+2 -1
View File
@@ -363,7 +363,8 @@ try {
*forceTrustClientOpt ? "--force-trusted" : "--force-untrusted"
);
}
runProgram2(options).release();
auto [pid, _stdout] = runProgram2(options).release();
pid.release();
} catch (Error & error) {
auto ei = error.info();
// FIXME: add to trace?