aboutsummaryrefslogtreecommitdiff
path: root/build2/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-23 16:09:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-25 08:05:43 +0200
commitad7d4bd0722aa70ba634900cebf93a1b1814fed9 (patch)
treefbfa28c4602dea0be178e63d1e6a1b2667e85190 /build2/context.cxx
parenta8bef4ff20100c518816c641ae1ff9783306c167 (diff)
Only do "effective escaping" (['"\$(]) on the command line
This will make things more convenient on Windows provided we use "sane" paths (no spaces, no (), etc).
Diffstat (limited to 'build2/context.cxx')
-rw-r--r--build2/context.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/build2/context.cxx b/build2/context.cxx
index e08fb52..f756bfc 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -97,7 +97,12 @@ namespace build2
{
istringstream is (s);
is.exceptions (istringstream::failbit | istringstream::badbit);
- lexer l (is, path ("<cmdline>"));
+
+ // Similar to buildspec we do "effective escaping" and only for ['"\$(]
+ // (basically what's necessary inside a double-quoted literal plus the
+ // single quote).
+ //
+ lexer l (is, path ("<cmdline>"), "\'\"\\$(");
// The first token should be a name, either the variable name or the
// scope qualification.
@@ -143,7 +148,7 @@ namespace build2
if (c == '!' && !dir.empty ())
fail << "scope-qualified global override of variable " << n;
- variable_visibility v (c == '/' ? variable_visibility::scope :
+ variable_visibility v (c == '/' ? variable_visibility::scope :
c == '%' ? variable_visibility::project :
variable_visibility::normal);