Splitting the PATH environ variable by a colons we have a path array containing the directories with the first entry erroneously preceded by a substring 'PATH='. If an executable invoked by boost::process::system( "" ) or boost::process:child( "") is expected to be located in that first PATH entry then executor::prepare_cmd_style() fails to build a full path to the executable. And this leads to process execution error.
In my example i have a "PATH=/usr/bin:/bin" and boost::process::child{ "wget" } fails with "No such file or directory" error because wget is located in /usr/bin.
The solution is to split the contents of the PATH variable not the full string "PATH=.."
The possible fix is to advance the *e pointer when boost::split() is invoked.
original [boost/process/detail/posix/executor.hpp]:
boost::split(path, *e, boost::is_any_of(":"));
change to:
boost::split(path, *e + 5, boost::is_any_of(":"));
, where 5 is the length of the "PATH=".