38 throw std::runtime_error(
39 "Program is not compiled with with millepde2. Please enable \"WITH_MILLEPEDE=ON\" with CMake.");
44 auto launch_args = std::vector<std::string>{
"-i", steer_filepath.string() };
45 auto exe_path = std::filesystem::path(exe_string);
46 if (not std::filesystem::exists(exe_path))
48 throw std::runtime_error(fmt::format(
"Command {:?} cannot be found or executed!", exe_string));
53 auto pede_program = bpv2::process{
ios_,
57 bpv2::process_stdio{ .in =
nullptr, .out = stdout, .err = stderr } };
58 pede_program.async_wait(
59 [](
const std::error_code& err,
int ret)
63 fmt::println(
"Error occured from the pede program. Error message: {}", err.message());
65 fmt::println(
"The pede program is closed successfully with the return value: {}", ret);
70 catch (std::exception& ex)
72 throw std::runtime_error(fmt::format(
"Error occured when launching pede with \"{} {}\": \n {}",
74 fmt::join(launch_args,
" "),
84 if (fs::exists(old_result_path))
87 "Info: copy the file {:?} to the file {:?}!\n", old_result_path.string(), new_result_path.string());
88 fs::copy(old_result_path, new_result_path, fs::copy_options::overwrite_existing);
92 fmt::print(
"Error: millepede.res doesn't exist!\n");