From 0f26bc3b825a8711a4f8c60b5ab746cba9d93bd7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 26 Apr 2018 15:00:52 +0200 Subject: Implement run buildfile directive Now we can do: run echo 'foo = bar' print $foo --- build2/utility.hxx | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'build2/utility.hxx') diff --git a/build2/utility.hxx b/build2/utility.hxx index e5c21e7..d5809bc 100644 --- a/build2/utility.hxx +++ b/build2/utility.hxx @@ -178,10 +178,13 @@ namespace build2 // case of an error. // process_path - run_search (const char*& args0); + run_search (const char*& args0, const location& = location ()); process_path - run_search (const path&, bool init, const dir_path& fallback = dir_path ()); + run_search (const path&, + bool init, + const dir_path& fallback = dir_path (), + const location& = location ()); // Wait for process termination. Issue diagnostics and throw failed in case // of abnormal termination. If the process has terminated normally but with @@ -194,12 +197,13 @@ namespace build2 run_finish (const char* args[], process&, bool error = true, - const string& = string ()); + const string& = string (), + const location& = location ()); inline void - run_finish (cstrings& args, process& pr) + run_finish (cstrings& args, process& pr, const location& l = location ()) { - run_finish (args.data (), pr); + run_finish (args.data (), pr, true, string (), l); } // Start a process with the specified arguments. If in is -1, then redirect @@ -216,7 +220,8 @@ namespace build2 int in, int out, bool error = true, - const dir_path& cwd = dir_path ()); + const dir_path& cwd = dir_path (), + const location& = location ()); inline process run_start (const process_path& pp, @@ -224,9 +229,10 @@ namespace build2 int in, int out, bool error = true, - const dir_path& cwd = dir_path ()) + const dir_path& cwd = dir_path (), + const location& l = location ()) { - return run_start (verb_never, pp, args, in, out, error, cwd); + return run_start (verb_never, pp, args, in, out, error, cwd, l); } inline void @@ -255,10 +261,23 @@ namespace build2 int in, int out, bool error = true, - const dir_path& cwd = dir_path ()) + const dir_path& cwd = dir_path (), + const location& l = location ()) { - process_path pp (run_search (args[0])); - return run_start (verbosity, pp, args, in, out, error, cwd); + process_path pp (run_search (args[0], l)); + return run_start (verbosity, pp, args, in, out, error, cwd, l); + } + + inline process + run_start (uint16_t verbosity, + cstrings& args, + int in, + int out, + bool error = true, + const dir_path& cwd = dir_path (), + const location& l = location ()) + { + return run_start (verbosity, args.data (), in, out, error, cwd, l); } inline void -- cgit v1.1