From cb558e4bd2b817bc72275c2bbd90dfe9fe380af9 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 8 Dec 2020 22:40:54 +0300 Subject: Add export script pseudo-builtin --- libbuild2/test/script/parser+env.test.testscript | 2 +- libbuild2/test/script/script.cxx | 8 ++++++++ libbuild2/test/script/script.hxx | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'libbuild2/test') diff --git a/libbuild2/test/script/parser+env.test.testscript b/libbuild2/test/script/parser+env.test.testscript index b6fb305..efa5dec 100644 --- a/libbuild2/test/script/parser+env.test.testscript +++ b/libbuild2/test/script/parser+env.test.testscript @@ -31,7 +31,7 @@ : invalid-val : $* <'env --unset=a=b -- cmd' 2>>EOE != 0 - testscript:1:5: error: env: invalid value 'a=b' for option '--unset': contains '=' + testscript:1:5: error: env: invalid value 'a=b' for option --unset: contains '=' EOE : no-sep diff --git a/libbuild2/test/script/script.cxx b/libbuild2/test/script/script.cxx index 165b9b7..3a8ceac 100644 --- a/libbuild2/test/script/script.cxx +++ b/libbuild2/test/script/script.cxx @@ -173,6 +173,14 @@ namespace build2 reset_special (); } + const environment_vars& scope:: + exported_variables (environment_vars& storage) + { + return parent != nullptr + ? parent->merge_exported_variables (exported_vars, storage) + : exported_vars; + } + // script_base // script_base:: diff --git a/libbuild2/test/script/script.hxx b/libbuild2/test/script/script.hxx index ea1f579..7dae78c 100644 --- a/libbuild2/test/script/script.hxx +++ b/libbuild2/test/script/script.hxx @@ -30,6 +30,7 @@ namespace build2 using build2::script::command_expr; using build2::script::expr_term; using build2::script::command; + using build2::script::environment_vars; using build2::script::deadline; using build2::script::timeout; @@ -110,6 +111,12 @@ namespace build2 const string& attrs, const location&) override; + // Merge the command execution environment variable (un)sets from this + // and outer scopes. + // + virtual const environment_vars& + exported_variables (environment_vars& storage) override; + // Noop since the temporary directory is a working directory and so // is created before the scope commands execution. // -- cgit v1.1