aboutsummaryrefslogtreecommitdiff
path: root/butl/process-run.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-04-18 10:40:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-04-18 10:40:18 +0200
commited93e07b1b7a9e0ba99609a9223e43247ff4224e (patch)
treeaa203bdab5a5fc4f5fd8af16baf6903a7ee3dde0 /butl/process-run.txx
parent4408607c51a7c6e293adae41403b21d4a2c9a429 (diff)
Implement curl process
Diffstat (limited to 'butl/process-run.txx')
-rw-r--r--butl/process-run.txx17
1 files changed, 9 insertions, 8 deletions
diff --git a/butl/process-run.txx b/butl/process-run.txx
index 8368890..4437488 100644
--- a/butl/process-run.txx
+++ b/butl/process-run.txx
@@ -55,20 +55,21 @@ namespace butl
//
const std::size_t args_size (sizeof... (args));
+ small_vector<const char*, args_size + 2> cmd;
+ cmd.push_back (pp.recall_string ());
+
std::string storage[args_size != 0 ? args_size : 1];
- const char* cmd[args_size + 2] = {
- pp.recall_string (),
- process_arg_as (args, storage[index])...,
- nullptr};
+ const char* dummy[] = {
+ nullptr, (process_args_as (cmd, args, storage[index]), nullptr)... };
- // The last argument can be NULL (used to handle zero A... pack).
- //
- cmdc (cmd, args_size + 2);
+ cmd.push_back (dummy[0]); // NULL (and get rid of unused warning).
+
+ cmdc (cmd.data (), cmd.size ());
// @@ Do we need to make sure certain fd's are closed before calling
// wait()? Is this only the case with pipes? Needs thinking.
- return process_start (cwd, pp, cmd, in_i, out_i, err_i);
+ return process_start (cwd, pp, cmd.data (), in_i, out_i, err_i);
}
template <typename C,