From b7f32cea30174e391027fecc9d431ca16b2f87c2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 25 Oct 2022 10:24:53 +0200 Subject: All passing to process ownership to one end of pipe --- libbutl/process-run.cxx | 2 +- libbutl/process-run.txx | 10 ++++++---- libbutl/process.cxx | 1 - libbutl/process.hxx | 28 ++++++++++++++++++++++++---- libbutl/process.ixx | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 67 insertions(+), 10 deletions(-) diff --git a/libbutl/process-run.cxx b/libbutl/process-run.cxx index a5014f6..b044ea1 100644 --- a/libbutl/process-run.cxx +++ b/libbutl/process-run.cxx @@ -24,7 +24,7 @@ namespace butl try { return process (pp, cmd, - in, out, err, + move (in), move (out), move (err), cwd != nullptr ? cwd->string ().c_str () : nullptr, envvars); } diff --git a/libbutl/process-run.txx b/libbutl/process-run.txx index 8e6ca57..67426f0 100644 --- a/libbutl/process-run.txx +++ b/libbutl/process-run.txx @@ -87,21 +87,21 @@ namespace butl // valid file descriptor. // inline process::pipe - process_stdin (const process::pipe& v) + process_stdin (process::pipe v) { assert (v.in >= 0); return v; } inline process::pipe - process_stdout (const process::pipe& v) + process_stdout (process::pipe v) { assert (v.out >= 0); return v; } inline process::pipe - process_stderr (const process::pipe& v) + process_stderr (process::pipe v) { assert (v.out >= 0); return v; @@ -170,7 +170,9 @@ namespace butl return process_start (env.cwd, *env.path, cmd.data (), env.vars, - in_i, out_i, err_i); + std::move (in_i), + std::move (out_i), + std::move (err_i)); } template