Get rid of bp::search_path
Boost filesystem was making some trouble when compiling with libc++. The
CI uses libc++ for LLVM builds, and the symbol names are different
between libc++ and libstdc++ (gnu). This difference would make the code
segfault inside Boost::filesystem. This patch gets rid of
Boost::filesystem linking.
Caveat: execAndWait now needs full file path.
Change-Id: Ia1abedc426f971884abda6c1ccbb897ad29c98ec
diff --git a/src/utils/exec.cpp b/src/utils/exec.cpp
index 2d8bfc8..f8e8a9a 100644
--- a/src/utils/exec.cpp
+++ b/src/utils/exec.cpp
@@ -14,7 +14,7 @@
void velia::utils::execAndWait(
velia::Log logger,
- const std::string& program,
+ const std::string& absolutePath,
std::initializer_list<std::string> args,
std::string_view std_in,
const std::set<ExecOptions> opts)
@@ -39,9 +39,9 @@
}
};
- logger->trace("exec: {} {}", program, boost::algorithm::join(args, " "));
+ logger->trace("exec: {} {}", absolutePath, boost::algorithm::join(args, " "));
bp::child c(
- bp::search_path(program),
+ absolutePath,
boost::process::args=std::move(args),
bp::std_in < stdinPipe, bp::std_out > bp::null, bp::std_err > stderrStream,
bp::extend::on_exec_setup=onExecSetup);
@@ -50,13 +50,13 @@
stdinPipe.close();
c.wait();
- logger->trace("{} exited", program);
+ logger->trace("{} exited", absolutePath);
if (c.exit_code()) {
std::istreambuf_iterator<char> begin(stderrStream), end;
std::string stderrOutput(begin, end);
- logger->critical("{} ended with a non-zero exit code. stderr: {}", program, stderrOutput);
+ logger->critical("{} ended with a non-zero exit code. stderr: {}", absolutePath, stderrOutput);
- throw std::runtime_error(program + " returned non-zero exit code " + std::to_string(c.exit_code()));
+ throw std::runtime_error(absolutePath + " returned non-zero exit code " + std::to_string(c.exit_code()));
}
}