From ae5cab7489fe014dd3aa818cf2655d7a4714af83 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 16 Dec 2017 17:42:12 +0200 Subject: Improve process execution diagnostics by reusing run_*() API --- build2/cli/init.cxx | 2 ++ build2/cli/rule.cxx | 20 ++------------------ 2 files changed, 4 insertions(+), 18 deletions(-) (limited to 'build2/cli') 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; } } -- cgit v1.1