From 1719d60531efed435d5a5c396abcda6385a4e64e Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Mon, 19 Jan 2026 19:28:46 +0100 Subject: [PATCH] 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 --- lix/libutil/processes.cc | 4 ++-- lix/libutil/processes.hh | 2 +- lix/nix/daemon.cc | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lix/libutil/processes.cc b/lix/libutil/processes.cc index 78e574c24..2bec570bc 100644 --- a/lix/libutil/processes.cc +++ b/lix/libutil/processes.cc @@ -306,9 +306,9 @@ RunningProgram::~RunningProgram() } } -std::tuple> RunningProgram::release() +std::tuple> RunningProgram::release() { - return {pid.release(), std::move(childStdout)}; + return {std::move(pid), std::move(childStdout)}; } int RunningProgram::kill() diff --git a/lix/libutil/processes.hh b/lix/libutil/processes.hh index 97e9c25b9..7e05f607d 100644 --- a/lix/libutil/processes.hh +++ b/lix/libutil/processes.hh @@ -121,7 +121,7 @@ public: explicit operator bool() const { return bool(pid); } - std::tuple> release(); + std::tuple> release(); int kill(); [[nodiscard]] diff --git a/lix/nix/daemon.cc b/lix/nix/daemon.cc index e0a923f46..dc72bcd11 100644 --- a/lix/nix/daemon.cc +++ b/lix/nix/daemon.cc @@ -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?