aboutsummaryrefslogtreecommitdiff
path: root/build2/cli
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-16 17:42:12 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-16 17:42:12 +0200
commitae5cab7489fe014dd3aa818cf2655d7a4714af83 (patch)
treea80fdc22ce5909b98bd58292aaf8e2bc28e70492 /build2/cli
parent530e8914ba00ce0e7ee89ba30d2b88f2c09f43c9 (diff)
Improve process execution diagnostics by reusing run_*() API
Diffstat (limited to 'build2/cli')
-rw-r--r--build2/cli/init.cxx2
-rw-r--r--build2/cli/rule.cxx20
2 files changed, 4 insertions, 18 deletions
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index d257efa..c698fd2 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -107,6 +107,8 @@ namespace build2
{
const char* args[] = {cli.string ().c_str (), "--version", nullptr};
+ // @@ TODO: redo using run_start()/run_finish().
+
try
{
pp = process::path_search (cli, true); // Can throw.
diff --git a/build2/cli/rule.cxx b/build2/cli/rule.cxx
index 83774a3..d05b190 100644
--- a/build2/cli/rule.cxx
+++ b/build2/cli/rule.cxx
@@ -283,25 +283,9 @@ namespace build2
else if (verb)
text << "cli " << s;
- try
- {
- process pr (cli, args.data ());
-
- if (!pr.wait ())
- throw failed ();
-
- t.mtime (system_clock::now ());
- }
- catch (const process_error& e)
- {
- error << "unable to execute " << args[0] << ": " << e;
-
- if (e.child)
- exit (1);
-
- throw failed ();
- }
+ run (cli, args);
+ t.mtime (system_clock::now ());
return target_state::changed;
}
}