3

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?

jpo38
  • 20,821
  • 10
  • 70
  • 151
  • You are using it correctly. May want to read this https://msdn.microsoft.com/en-us/library/074af4b6.aspx – StoryTeller - Unslander Monica Dec 04 '17 at 10:27
  • @StoryTeller: Thanks, but it's unclear to me how the example provided by Microsoft could help removing the warning in my case....what would be the "no warning syntax"? (I have a requirement to have code compile with no warning, and we always prefer to avoid disabling a warning, even locally). – jpo38 Dec 04 '17 at 10:37

1 Answers1

6

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);
    ...
}
sehe
  • 374,641
  • 47
  • 450
  • 633