MCPcopy Create free account
hub / github.com/boostorg/stacktrace / copy_and_run

Function copy_and_run

example/terminate_handler.cpp:72–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71#ifndef BOOST_WINDOWS
72inline void copy_and_run(const char* exec_name, char param, bool not_null) {
73 std::cout << "Running with param " << param << std::endl;
74 boost::filesystem::path command = exec_name;
75 command = command.parent_path() / (command.stem().string() + param + command.extension().string());
76 boost::filesystem::copy_file(exec_name, command, boost::filesystem::copy_options::overwrite_existing);
77
78 boost::filesystem::path command_args = command;
79 command_args += ' ';
80 command_args += param;
81 const int ret = std::system(command_args.string().c_str());
82
83 std::cout << "End Running with param " << param << "; ret code is " << ret << std::endl;
84 boost::system::error_code ignore;
85 boost::filesystem::remove(command, ignore);
86 if (not_null && !ret) {
87 std::exit(97);
88 } else if (!not_null && ret) {
89 std::exit(ret);
90 }
91}
92#endif
93
94int run_0(const char* /*argv*/[]) {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected