aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/script/script.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-10-13 20:05:27 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-10-13 20:05:27 +0300
commit4564a26c0b88d684c12c396d7ef5b0e66f686964 (patch)
tree130e744bd182110184171fb38677f0fca60ec73f /libbuild2/script/script.cxx
parentb7997a0becbecd775694aa7f106afb3c0e777b8d (diff)
Add --cwd|-t option to env pseudo-builtin
Diffstat (limited to 'libbuild2/script/script.cxx')
-rw-r--r--libbuild2/script/script.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/libbuild2/script/script.cxx b/libbuild2/script/script.cxx
index 298d71f..9e6eeed 100644
--- a/libbuild2/script/script.cxx
+++ b/libbuild2/script/script.cxx
@@ -411,7 +411,7 @@ namespace build2
{
// Print the env builtin if any of its options/arguments are present.
//
- if (!c.variables.empty () || c.timeout)
+ if (c.timeout || c.cwd || !c.variables.empty ())
{
o << "env";
@@ -421,6 +421,14 @@ namespace build2
o << " -t "
<< chrono::duration_cast<chrono::seconds> (*c.timeout).count ();
+ // CWD.
+ //
+ if (c.cwd)
+ {
+ o << " -c ";
+ print_path (*c.cwd);
+ }
+
// Variable unsets/sets.
//
auto b (c.variables.begin ()), i (b), e (c.variables.end ());