boostorg / process

Boost Process
https://www.boost.org/libs/process
118 stars 118 forks source link

wrapper function taking exe and args #419

Open user706 opened 4 weeks ago

user706 commented 4 weeks ago

How does one write a wrapper function taking boost::process::exe and boost::process::args.

is boost::process::exe even a type? seems not...

What trickery is this? Thanks.

user706 commented 4 weeks ago

this does not compile:

#include <boost/process.hpp>
#include <string>

std::string getStdOutFromCommand(const std::decay_t<decltype(boost::process::exe)> &exe, const std::decay_t<decltype(boost::process::args)> &args)
{
    boost::process::ipstream pipe_stream;
    boost::process::child c(exe, args, boost::process::std_out > pipe_stream);
   // ...
}
klemens-morgenstern commented 4 weeks ago

Switch to boost.process v2 and use filesystem::path & vector<string>. Seriously, this trickery was a mistake.