aboutsummaryrefslogtreecommitdiff
path: root/build2/utility.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-20 09:51:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-20 09:51:56 +0200
commit353438a94953bf4d093af0d84decd5ec7529ed34 (patch)
tree4c4e376ff8d831e85954a9b74f2157ad4b06351a /build2/utility.hxx
parentc6b3f6659eda9b0b255ddc2d24accdd998b5938d (diff)
Add $process.run() and $process.run_regex() functions
$process.run(<prog>[ <args>...]) Return trimmed stdout. $process.run_regex(<prog>[ <args>...], <pat> [, <fmt>]) Return stdout lines matched and optionally processed with regex. Each line of stdout (including the customary trailing blank) is matched (as a whole) against <pat> and, if successful, returned, optionally processed with <fmt>, as an element of a list.
Diffstat (limited to 'build2/utility.hxx')
-rw-r--r--build2/utility.hxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/build2/utility.hxx b/build2/utility.hxx
index 81a5d87..6e76f05 100644
--- a/build2/utility.hxx
+++ b/build2/utility.hxx
@@ -154,7 +154,7 @@ namespace build2
process_path
run_search (const path&,
- bool init,
+ bool init = false,
const dir_path& fallback = dir_path (),
const location& = location ());
@@ -388,12 +388,16 @@ namespace build2
verbosity, pp, args, forward<F> (f), error, ignore_exit, checksum);
}
- // Empty string and path.
+ // Empty/nullopt string and path.
//
- extern const string empty_string;
- extern const path empty_path;
+ extern const string empty_string;
+ extern const path empty_path;
extern const dir_path empty_dir_path;
+ extern const optional<string> nullopt_string;
+ extern const optional<path> nullopt_path;
+ extern const optional<dir_path> nullopt_dir_path;
+
// Hash a path potentially without the specific directory prefix.
//
// If prefix is not empty and is a super-path of the path to hash, then only