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/dist/operation.cxx | 65 ++++++++--------------------------------------- 1 file changed, 10 insertions(+), 55 deletions(-) (limited to 'build2/dist') diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx index 7539fc1..7644ba9 100644 --- a/build2/dist/operation.cxx +++ b/build2/dist/operation.cxx @@ -395,22 +395,7 @@ namespace build2 else if (verb) text << "dist -d " << d; - try - { - process pr (cmd, args.data ()); - - if (!pr.wait ()) - throw failed (); - } - catch (const process_error& e) - { - error << "unable to execute " << args[0] << ": " << e; - - if (e.child) - exit (1); - - throw failed (); - } + run (cmd, args); } // install @@ -449,22 +434,7 @@ namespace build2 else if (verb) text << "dist " << t; - try - { - process pr (cmd, args.data ()); - - if (!pr.wait ()) - throw failed (); - } - catch (const process_error& e) - { - error << "unable to execute " << args[0] << ": " << e; - - if (e.child) - exit (1); - - throw failed (); - } + run (cmd, args); return d / relf.leaf (); } @@ -494,31 +464,16 @@ namespace build2 args = {"tar", "-a", "-cf", ap.string ().c_str (), pkg.c_str (), nullptr}; - try - { - process_path pp (process::path_search (args[0])); - - if (verb >= 2) - print_process (args); - else if (verb) - text << args[0] << " " << ap; + process_path pp (run_search (args[0])); - // Change child's working directory to dist_root. - // - process pr (pp, args.data (), 0, 1, 2, root.string ().c_str ()); - - if (!pr.wait ()) - throw failed (); - } - catch (const process_error& e) - { - error << "unable to execute " << args[0] << ": " << e; - - if (e.child) - exit (1); + if (verb >= 2) + print_process (args); + else if (verb) + text << args[0] << " " << ap; - throw failed (); - } + // Change child's working directory to dist_root. + // + run (pp, args, root); } const meta_operation_info mo_dist { -- cgit v1.1