From 353438a94953bf4d093af0d84decd5ec7529ed34 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 20 Jun 2018 09:51:56 +0200 Subject: Add $process.run() and $process.run_regex() functions $process.run([ ...]) Return trimmed stdout. $process.run_regex([ ...], [, ]) Return stdout lines matched and optionally processed with regex. Each line of stdout (including the customary trailing blank) is matched (as a whole) against and, if successful, returned, optionally processed with , as an element of a list. --- build2/variable.cxx | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'build2/variable.cxx') diff --git a/build2/variable.cxx b/build2/variable.cxx index 8000913..0c07db6 100644 --- a/build2/variable.cxx +++ b/build2/variable.cxx @@ -600,7 +600,20 @@ namespace build2 catch (invalid_path& e) { n.value = move (e.path); // Restore the name object for diagnostics. + // Fall through. + } + } + // Reassemble split dir/value. + // + if (n.untyped () && n.unqualified ()) + { + try + { + return n.dir / n.value; + } + catch (const invalid_path&) + { // Fall through. } } @@ -649,7 +662,26 @@ namespace build2 { return dir_path (move (n.value)); } - catch (const invalid_path&) {} // Fall through. + catch (invalid_path& e) + { + n.value = move (e.path); // Restore the name object for diagnostics. + // Fall through. + } + } + + // Reassemble split dir/value. + // + if (n.untyped () && n.unqualified ()) + { + try + { + n.dir /= n.value; + return move (n.dir); + } + catch (const invalid_path&) + { + // Fall through. + } } // Fall through. -- cgit v1.1