From e930d5c9cb4176c6055bde2b4ff196f4b5f92f69 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 21 Aug 2016 12:36:35 +0200 Subject: Redo process path search to better accommodate Windows-specific semantics --- butl/process.ixx | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) (limited to 'butl/process.ixx') diff --git a/butl/process.ixx b/butl/process.ixx index 3b7ed7d..59ac60c 100644 --- a/butl/process.ixx +++ b/butl/process.ixx @@ -2,8 +2,39 @@ // copyright : Copyright (c) 2014-2016 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include // move() + namespace butl { + inline process_path:: + process_path (process_path&& p) + : initial (p.initial), + recall (std::move (p.recall)), + effect (std::move (p.effect)), + args0_ (p.args0_) + { + p.args0_ = nullptr; + } + + inline process_path& process_path:: + operator= (process_path&& p) + { + if (this != &p) + { + if (args0_ != nullptr) + *args0_ = initial; + + initial = p.initial; + recall = std::move (p.recall); + effect = std::move (p.effect); + args0_ = p.args0_; + + p.args0_ = nullptr; + } + + return *this; + } + inline process:: process () : handle (0), @@ -15,12 +46,30 @@ namespace butl } inline process:: - process (char const* const args[], int in, int out, int err) - : process (nullptr, args, in, out, err) {} + process (const char* args[], int in, int out, int err) + : process (nullptr, path_search (args[0]), args, in, out, err) {} + + inline process:: + process (const process_path& pp, const char* args[], + int in, int out, int err) + : process (nullptr, pp, args, in, out, err) {} + + inline process:: + process (const char* args[], process& in, int out, int err) + : process (nullptr, path_search (args[0]), args, in, out, err) {} + + inline process:: + process (const process_path& pp, const char* args[], + process& in, int out, int err) + : process (nullptr, pp, args, in, out, err) {} + + inline process:: + process (const char* cwd, const char* args[], int in, int out, int err) + : process (cwd, path_search (args[0]), args, in, out, err) {} inline process:: - process (char const* const args[], process& in, int out, int err) - : process (nullptr, args, in, out, err) {} + process (const char* cwd, const char* args[], process& in, int out, int err) + : process (cwd, path_search (args[0]), args, in, out, err) {} inline process:: process (process&& p) -- cgit v1.1