aboutsummaryrefslogtreecommitdiff
path: root/bdep/utility.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-09 09:48:07 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2018-07-27 14:23:07 +0300
commit07fdebdbb02fde71d6e656ddd46b967347417502 (patch)
tree594c2f352499aaac0756e3071a4b7ce2aee0fd34 /bdep/utility.txx
parent8a87a8bc08f0d692f53a0373da3a0a959de13e52 (diff)
Implement publish command for publishing packages to archive repositories
Diffstat (limited to 'bdep/utility.txx')
-rw-r--r--bdep/utility.txx38
1 files changed, 22 insertions, 16 deletions
diff --git a/bdep/utility.txx b/bdep/utility.txx
index 23a8c8a..84248d0 100644
--- a/bdep/utility.txx
+++ b/bdep/utility.txx
@@ -35,15 +35,10 @@ namespace bdep
}
}
- template <typename P, typename... A>
+ template <typename P>
void
- run (const P& prog, A&&... args)
+ finish (const P& prog, process& pr, bool io_read, bool io_write)
{
- process pr (start (0 /* stdin */,
- 1 /* stdout */,
- 2 /* stderr */,
- prog,
- forward<A> (args)...));
if (!pr.wait ())
{
const process_exit& e (*pr.exit);
@@ -53,6 +48,25 @@ namespace bdep
fail << "process " << prog << " " << e;
}
+
+ if (io_read)
+ fail << "error reading " << prog << " output";
+
+ if (io_write)
+ fail << "error writing " << prog << " input";
+ }
+
+ template <typename P, typename... A>
+ void
+ run (const P& prog, A&&... args)
+ {
+ process pr (start (0 /* stdin */,
+ 1 /* stdout */,
+ 2 /* stderr */,
+ prog,
+ forward<A> (args)...));
+
+ finish (prog, pr);
}
// *_bpkg()
@@ -215,15 +229,7 @@ namespace bdep
1 /* stdout */,
2 /* stderr */,
forward<A> (args)...));
- if (!pr.wait ())
- {
- const process_exit& e (*pr.exit);
-
- if (e.normal ())
- throw failed (); // Assume the child issued diagnostics.
-
- fail << "process " << name_b (co) << " " << e;
- }
+ finish_b (co, pr);
}
// *_manifest()