From 10b8bbbed4230553dfbe608d4772dfaeee98c19d Mon Sep 17 00:00:00 2001 From: Michael Spector Date: Mon, 4 Dec 2017 22:06:05 +0200 Subject: [PATCH] Allow to provide arguments to Popen using std::vector --- subprocess.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subprocess.hpp b/subprocess.hpp index fe4a25c..ecbcc95 100755 --- a/subprocess.hpp +++ b/subprocess.hpp @@ -959,6 +959,17 @@ class Popen if (!defer_process_start_) execute_process(); } + template + Popen(std::vector vargs_, Args&& ...args):vargs_(vargs_) + { + init_args(std::forward(args)...); + + // Setup the communication channels of the Popen class + stream_.setup_comm_channels(); + + if (!defer_process_start_) execute_process(); + } + void start_process() throw (CalledProcessError, OSError); int pid() const noexcept { return child_pid_; }