File indexing completed on 2026-10-09 08:30:26
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <boost/process.hpp>
0012
0013 namespace ActsPlugins::detail {
0014
0015 MpSolverStatus runChildProcessBoost(const std::string& program,
0016 const std::vector<std::string>& args,
0017 const std::filesystem::path& runDir,
0018 const WrappedFileHandle& outputHandle,
0019 const Acts::Logger& logger) {
0020 namespace bp = boost::process;
0021
0022
0023 auto thePede = bp::search_path(program);
0024 if (thePede.empty()) {
0025 ACTS_ERROR("Failed to find the solver program '" << program << "'");
0026 return MpSolverStatus::ProgNotFound;
0027 }
0028
0029 bp::child theProcess;
0030 if (outputHandle.isRedirected()) {
0031 theProcess = bp::child(thePede, args, bp::start_dir = runDir.string(),
0032 (bp::std_out & bp::std_err) > outputHandle());
0033 } else {
0034 theProcess = bp::child(thePede, args, bp::start_dir = runDir.string());
0035 }
0036
0037 theProcess.wait();
0038 if (theProcess.exit_code() != 0) {
0039 return MpSolverStatus::FailedRun;
0040 ACTS_ERROR("Failed to run the solver process!");
0041 }
0042 return MpSolverStatus::OK;
0043 }
0044
0045 }