aboutsummaryrefslogtreecommitdiff
path: root/bpkg/diagnostics
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-04 14:15:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-04 14:15:37 +0200
commit81abf8eab067eab362f180a418215f9408de41dc (patch)
treefd9915dd0ac551e989247fcd2cc78f57a378b6c4 /bpkg/diagnostics
parent0aa9007705231b72616c533aeed6a28ca3349999 (diff)
Add support for printing process command line
Diffstat (limited to 'bpkg/diagnostics')
-rw-r--r--bpkg/diagnostics31
1 files changed, 30 insertions, 1 deletions
diff --git a/bpkg/diagnostics b/bpkg/diagnostics
index 85eef2b..af9bde0 100644
--- a/bpkg/diagnostics
+++ b/bpkg/diagnostics
@@ -17,11 +17,41 @@
namespace bpkg
{
+ struct diag_record;
+
// Throw this exception to terminate the process. The handler should
// assume that the diagnostics has already been issued.
//
class failed: public std::exception {};
+ // Print process commmand line. If the number of elements is specified
+ // (or the second version is used), then it will print the piped multi-
+ // process command line, if present. In this case, the expected format
+ // is as follows:
+ //
+ // name1 arg arg ... nullptr
+ // name2 arg arg ... nullptr
+ // ...
+ // nameN arg arg ... nullptr nullptr
+ //
+ void
+ print_process (diag_record&, const char* const* args, std::size_t n = 0);
+
+ void
+ print_process (const char* const* args, std::size_t n = 0);
+
+ inline void
+ print_process (diag_record& dr, const cstrings& args)
+ {
+ print_process (dr, args.data (), args.size ());
+ }
+
+ inline void
+ print_process (const cstrings& args)
+ {
+ print_process (args.data (), args.size ());
+ }
+
// Trace verbosity level.
//
// 0 - tracing disabled.
@@ -45,7 +75,6 @@ namespace bpkg
//
extern std::ostream* diag_stream;
- struct diag_record;
template <typename> struct diag_prologue;
template <typename> struct diag_mark;