将向量或参数传递给 boost::process (boost::fusion)

jpo*_*o38 3 c++ boost boost-fusion boost-process

boost::process我正在尝试从字符串参数向量创建一个:

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

这显然有效,但我收到以下警告:

警告 C4503:'boost::fusion::detail::for_each_linear':超出修饰名称长度,名称被截断

如果一一传递参数,它就会消失bp::child c(exe, "param1", "param2", std_out > out);

在这种情况下调用child构造函数的正确方法是什么?

seh*_*ehe 8

您将按预期使用:

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

在你的情况下也许像

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);
    ...
}
Run Code Online (Sandbox Code Playgroud)