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 #include <boost/process/environment.hpp>
0013 #include <boost/process/process.hpp>
0014 #include <boost/process/start_dir.hpp>
0015 #include <boost/process/stdio.hpp>
0016
0017 namespace ActsPlugins::detail {
0018
0019
0020 MpSolverStatus runChildProcessBoost(const std::string& program,
0021 const std::vector<std::string>& args,
0022 const std::filesystem::path& runDir,
0023 const WrappedFileHandle& outputHandle,
0024 const Acts::Logger& logger) {
0025 using namespace boost::process;
0026
0027
0028 auto thePede = environment::find_executable(program);
0029 if (thePede.empty()) {
0030 ACTS_ERROR("Failed to find the solver program '" << program << "'");
0031 return MpSolverStatus::ProgNotFound;
0032 }
0033
0034 boost::asio::io_context io;
0035
0036 process_stdio stdio{};
0037 if (outputHandle.isRedirected()) {
0038 stdio = process_stdio{{}, outputHandle(), outputHandle()};
0039 }
0040
0041 process theProcess(io, thePede, args, process_start_dir(runDir.string()),
0042 stdio);
0043 theProcess.wait();
0044 if (theProcess.exit_code() != 0) {
0045 ACTS_ERROR("Failed to run the solver process!");
0046 return detail::MpSolverStatus::FailedRun;
0047 }
0048 return detail::MpSolverStatus::OK;
0049 }
0050
0051 }