From ca0fa738650ab546b1422e0b2dbfdc89ba8eb5a3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 6 Apr 2020 16:19:38 +0200 Subject: Add ability to print process_env environment --- libbutl/process.mxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libbutl/process.mxx') diff --git a/libbutl/process.mxx b/libbutl/process.mxx index 1f378c4..b8c6054 100644 --- a/libbutl/process.mxx +++ b/libbutl/process.mxx @@ -494,7 +494,6 @@ LIBBUTL_MODEXPORT namespace butl quote_argument (const char*, std::string& buffer); #endif - public: id_type id () const; @@ -548,6 +547,16 @@ LIBBUTL_MODEXPORT namespace butl const dir_path* cwd = nullptr; const char* const* vars = nullptr; + // Return true if there is an "environment", that is, either the current + // working directory or environment variables. + // + bool + env () const + { + return (cwd != nullptr && !cwd->empty ()) || + (vars != nullptr && *vars != nullptr); + } + process_env (const process_path& p, const dir_path& c = dir_path (), const char* const* v = nullptr) -- cgit v1.1