Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-09 08:30:26

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "RunSolverProcess.hpp"
0010 
0011 #include "Acts/Utilities/Logger.hpp"
0012 
0013 #include <filesystem>
0014 
0015 #include "WrappedFileHandle.hpp"
0016 
0017 // The mechanics of launching a child in Boost::Process vary
0018 // between versions before and after 1.88. Make sure to
0019 // pick up the one supported by the user's boost install.
0020 #ifdef ACTS_MILLE_USE_BOOST_PROCESS_V2
0021 #include "SolverProcessCall_BoostV2.hpp"
0022 #else
0023 #include "SolverProcessCall_BoostV1.hpp"
0024 #endif
0025 
0026 namespace ActsPlugins::detail {
0027 MpSolverStatus runSolverProcess(
0028     const std::string& program, const std::vector<std::string>& args,
0029     const std::filesystem::path& runDir, const Acts::Logger& logger,
0030     const std::optional<std::filesystem::path>& redirectOutput) {
0031   // work dir has to exist - caller's responsibility
0032   if (!std::filesystem::exists(runDir)) {
0033     ACTS_ERROR("Run directory '" << runDir
0034                                  << "' does not exist, will not run solver");
0035     return MpSolverStatus::FailedWorkDir;
0036   }
0037 
0038   WrappedFileHandle outputHandle;  // defaults to "do not redirect"
0039 
0040   if (redirectOutput.has_value()) {
0041     outputHandle = WrappedFileHandle(*redirectOutput);
0042     if (!outputHandle.isRedirected()) {
0043       ACTS_ERROR("Failed to redirect output to '" << *redirectOutput << "'");
0044       return MpSolverStatus::FailedRedirectStdout;
0045     }
0046   }
0047   return runChildProcessBoost(program, args, runDir, outputHandle, logger);
0048 }
0049 }  // namespace ActsPlugins::detail