diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-12-16 17:42:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-12-16 17:42:12 +0200 |
commit | ae5cab7489fe014dd3aa818cf2655d7a4714af83 (patch) | |
tree | a80fdc22ce5909b98bd58292aaf8e2bc28e70492 /build2/dist/operation.cxx | |
parent | 530e8914ba00ce0e7ee89ba30d2b88f2c09f43c9 (diff) |
Improve process execution diagnostics by reusing run_*() API
Diffstat (limited to 'build2/dist/operation.cxx')
-rw-r--r-- | build2/dist/operation.cxx | 65 |
1 files changed, 10 insertions, 55 deletions
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 <file> <dir> @@ -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 { |