30 throw std::runtime_error(
31 "Program is not compiled with with millepde2. Please enable \"WITH_MILLEPEDE=ON\" with CMake.");
33 const auto exe_string = fmt::format(
"{}/{}", binary_directory_, executable_);
34 auto launch_args = std::vector<std::string>{
"-i", steer_filename_ };
35 auto exe_path = std::filesystem::path(exe_string);
36 if (not std::filesystem::exists(exe_path))
38 throw std::runtime_error(fmt::format(
"Command {:?} cannot be found or executed!", exe_string));
45 bp::args(launch_args),
49 bp::on_exit = [](
int pid,
const std::error_code& err)
50 { fmt::print(
"Child process returns {} with error code: {}\n", pid, err.message()); } };
53 fmt::print(
"Child process with PID {} ended.\n", pede_program.id());
56 catch (std::exception& ex)
58 throw std::runtime_error(fmt::format(
"Error occured when launching pede with \"{} {}\": \n {}",
59 bp::search_path(executable_).
string(),
60 fmt::join(launch_args,
" "),
68 auto new_result_path = fs::current_path() / fs::path{ parameter_file_ };
70 if (fs::exists(old_result_path))
73 "Info: copy the file {:?} to the file {:?}!\n", old_result_path.string(), new_result_path.string());
74 fs::copy(old_result_path, new_result_path, fs::copy_options::overwrite_existing);
78 fmt::print(
"Error: millepede.res doesn't exist!\n");