A toy program works when invoked from its build directory:
$ cd build
$ ./test
27610c1a6b49a0f459fc9e39a374f2e5b9b5e3175b0e926af4c7359c6bd7f93f
but when invoked from the project root one level above, it generates an error I cannot find meaningful search results about:
$ build/test
terminate called after throwing an instance of 'boost::process::process_error'
what(): execve failed: Permission denied
Aborted (core dumped)
I would like it to work in both ways. How?
I cannot reproduce this behaviour by invoking docker from the command line, so I am inclined to believe it is not at fault. Yet, if I replace the invocation with a simple ls, that does work in both cases.
Code:
#include <boost/process.hpp>
int main()
{
boost::process::system("docker run --detach --rm 3151172cc781");
}
(Before I MVEd this, it was a Boost test suite intended to run an image and execute various tests on the resulting containers.)
I'd suggest something like
namespace bp = boost::process::v1;
bp::child c(bp::search_path("docker"), { "run", "--detach", "--rm", "3151172cc781" });
I'm not at a computer right now. Will add self-contained example later.
That appears to have been deprecated (process::v1 namespace). In v2, there's apparently a separate path searcher:
// search in the current environment
auto exe = environment::find_executable("g++");
Which just returns the found path as a boost::filesystem::path