aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/build/script/runner.cxx14
-rw-r--r--libbuild2/build/script/runner.hxx6
2 files changed, 12 insertions, 8 deletions
diff --git a/libbuild2/build/script/runner.cxx b/libbuild2/build/script/runner.cxx
index 0be55a5..5535bbb 100644
--- a/libbuild2/build/script/runner.cxx
+++ b/libbuild2/build/script/runner.cxx
@@ -32,21 +32,19 @@ namespace build2
if (verb >= 3)
text << ": " << expr;
- // Run the expression if we are not in the dry run mode or if it
- // executes the set builtin and print the expression otherwise, unless
- // it is already printed or the verbosity level is lower than 2.
- //
- // @@ Should we also run expressions that execute the exit builtin in
- // the dry run mode?
+ // Run the expression if we are not in the dry-run mode or if it
+ // executes the set or exit builtin and just print the expression
+ // otherwise at verbosity level 2 and up.
//
if (!env.context.dry_run ||
find_if (expr.begin (), expr.end (),
[] (const expr_term& et)
{
- return et.pipe.back ().program.string () == "set";
+ const string& p (et.pipe.back ().program.string ());
+ return p == "set" || p == "exit";
}) != expr.end ())
build2::script::run (env, expr, li, ll);
- else if (verb == 2)
+ else if (verb >= 2)
text << expr;
}
diff --git a/libbuild2/build/script/runner.hxx b/libbuild2/build/script/runner.hxx
index db211df..431c446 100644
--- a/libbuild2/build/script/runner.hxx
+++ b/libbuild2/build/script/runner.hxx
@@ -50,6 +50,12 @@ namespace build2
leave (environment&, const location&) = 0;
};
+ // Run command expressions.
+ //
+ // In dry-run mode don't run the expressions unless they are if-
+ // conditions or execute the set or exit builtins, but prints them at
+ // verbosity level 2 and up.
+ //
class default_runner: public runner
{
public: