diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-05-20 20:42:45 +0300 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-27 08:38:57 +0200 |
commit | 7765f51c5f6429fcb45a6c195b71929c392b0a31 (patch) | |
tree | fc846784b51451ca8e128306218494cf13c7d816 /libbuild2/build | |
parent | e222cbabb84b5a6357242e47196f7e0eeb69a44f (diff) |
Make build script runner to execute exit-containing expression in dry-run mode
Diffstat (limited to 'libbuild2/build')
-rw-r--r-- | libbuild2/build/script/runner.cxx | 14 | ||||
-rw-r--r-- | libbuild2/build/script/runner.hxx | 6 |
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: |