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:
@@ -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()
|
||||
|
||||
@@ -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
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user