diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-21 12:36:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-21 12:36:35 +0200 |
commit | e930d5c9cb4176c6055bde2b4ff196f4b5f92f69 (patch) | |
tree | 948cd3832e609248d02c8abaafe16385f93a44a7 /butl/process.ixx | |
parent | b6616430560102415bb82062b845a23c830bac0d (diff) |
Redo process path search to better accommodate Windows-specific semantics
Diffstat (limited to 'butl/process.ixx')
-rw-r--r-- | butl/process.ixx | 57 |
1 files changed, 53 insertions, 4 deletions
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 <utility> // 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) |