From 67617fc444600cad5de2338f4d6f49d7a46fd915 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 12 Feb 2020 13:54:40 +0200 Subject: Add convenience run_start() overload --- libbuild2/cc/gcc.cxx | 2 +- libbuild2/cc/guess.cxx | 4 ++-- libbuild2/dist/operation.cxx | 2 +- libbuild2/functions-process.cxx | 2 +- libbuild2/utility.hxx | 27 ++++++++++++++++++++++++++- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/libbuild2/cc/gcc.cxx b/libbuild2/cc/gcc.cxx index 7c32a65..84d4e01 100644 --- a/libbuild2/cc/gcc.cxx +++ b/libbuild2/cc/gcc.cxx @@ -243,7 +243,7 @@ namespace build2 // Open pipe to stdout. // process pr (run_start (xc, - args.data (), + args, 0, /* stdin */ -1 /* stdout */)); diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx index f2a6189..c47e5a1 100644 --- a/libbuild2/cc/guess.cxx +++ b/libbuild2/cc/guess.cxx @@ -184,7 +184,7 @@ namespace build2 // process pr (run_start (3 /* verbosity */, xp, - args.data (), + args, -1 /* stdin */, -1 /* stdout */, false /* error */)); @@ -1942,7 +1942,7 @@ namespace build2 // process pr (run_start (3 /* verbosity */, xp, - args.data (), + args, -2 /* stdin (/dev/null) */, -1 /* stdout */, false /* error (2>&1) */)); diff --git a/libbuild2/dist/operation.cxx b/libbuild2/dist/operation.cxx index 52031a3..34dc747 100644 --- a/libbuild2/dist/operation.cxx +++ b/libbuild2/dist/operation.cxx @@ -694,7 +694,7 @@ namespace build2 // Change the archiver's working directory to dist_root. // apr = run_start (app, - args.data (), + args, 0 /* stdin */, (i != 0 ? -1 : 1) /* stdout */, true /* error */, diff --git a/libbuild2/functions-process.cxx b/libbuild2/functions-process.cxx index 57f6fe6..ce12782 100644 --- a/libbuild2/functions-process.cxx +++ b/libbuild2/functions-process.cxx @@ -79,7 +79,7 @@ namespace build2 return run_start (3 /* verbosity */, pp, - cargs.data (), + cargs, 0 /* stdin */, -1 /* stdout */); } diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx index 50af5e6..18122e0 100644 --- a/libbuild2/utility.hxx +++ b/libbuild2/utility.hxx @@ -293,7 +293,20 @@ namespace build2 const location& = location ()); inline process - run_start (const process_env& pe, // Implicit-constructible from process_path. + run_start (uint16_t verbosity, + const process_env& pe, + cstrings& args, + int in, + int out, + bool error = true, + const dir_path& cwd = dir_path (), + const location& l = location ()) + { + return run_start (verbosity, pe, args.data (), in, out, error, cwd, l); + } + + inline process + run_start (const process_env& pe, const char* args[], int in, int out, @@ -304,6 +317,18 @@ namespace build2 return run_start (verb_never, pe, args, in, out, error, cwd, l); } + inline process + run_start (const process_env& pe, + cstrings& args, + int in, + int out, + bool error = true, + const dir_path& cwd = dir_path (), + const location& l = location ()) + { + return run_start (pe, args.data (), in, out, error, cwd, l); + } + inline void run (const process_path& p, const char* args[], -- cgit v1.1