Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing a vector or arguments to boost::process (boost::fusion)

I'm trying to create a boost::process from a vector of string arguments:

void runProcess( const std::string& exe, const std::vector<std::string>& args )
{
    bp::ipstream out;
    bp::child c(exe, args, std_out > out);
    ...
}

This apparently works, but I'm getting the following warning:

warning C4503: 'boost::fusion::detail::for_each_linear': decorated name length exceeded, name was truncated

It diseappears if passing arguments one by one bp::child c(exe, "param1", "param2", std_out > out);.

What is the correct way to call childconstructor in this situation?

like image 283
jpo38 Avatar asked Jan 17 '26 05:01

jpo38


1 Answers

You would use the as intended:

bp::child c(bp::search_path("ls"), bp::args({"-1", "-l"})/*, ...*/);

In your case maybe like

void runProcess( const std::string& exe, const std::vector<std::string>& args )
{
    bp::ipstream out;
    bp::child c(exe, bp::args(args), std_out > out);
    ...
}
like image 89
sehe Avatar answered Jan 19 '26 18:01

sehe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!