From 338a16f0df3c45bcbeaf5e7ffd0b4dc515e11502 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 21 Aug 2018 10:36:53 +0200 Subject: Make process_env usable with C array of environment variables --- libbutl/process-run.txx | 5 ++--- libbutl/process.mxx | 14 +++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'libbutl') diff --git a/libbutl/process-run.txx b/libbutl/process-run.txx index f6c14f5..85e51e2 100644 --- a/libbutl/process-run.txx +++ b/libbutl/process-run.txx @@ -5,9 +5,8 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. { template - process_env:: - process_env (const process_path& p, const V& v) - : process_env (p) + void process_env:: + init_vars (const V& v) { if (!v.empty ()) { diff --git a/libbutl/process.mxx b/libbutl/process.mxx index a536fe9..8f8b930 100644 --- a/libbutl/process.mxx +++ b/libbutl/process.mxx @@ -536,7 +536,8 @@ LIBBUTL_MODEXPORT namespace butl : process_env (p, v) {cwd = &c;} template - process_env (const process_path& p, const V& v); + process_env (const process_path& p, const V& v) + : process_env (p) {init_vars (v);} process_env (const char* p, const dir_path& c = dir_path (), @@ -578,6 +579,17 @@ LIBBUTL_MODEXPORT namespace butl : process_env (p.string (), v) {} private: + template + void + init_vars (const V&); + + template + void + init_vars (const char* const (&v)[N]) + { + vars = v; + } + process_path path_; small_vector vars_; }; -- cgit v1.1