MCPcopy Create free account
hub / github.com/apache/arrow / SetExecutable

Method SetExecutable

cpp/src/arrow/testing/process.cc:164–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162 }
163
164 Status SetExecutable(const std::string& name) {
165#ifdef BOOST_PROCESS_AVAILABLE
166# ifdef BOOST_PROCESS_USE_V2
167 executable_ = process::environment::find_executable(name);
168# else
169 executable_ = process::search_path(name);
170# endif
171 if (executable_.empty()) {
172 // Search the current executable directory as fallback.
173 ARROW_ASSIGN_OR_RAISE(auto current_exe, ResolveCurrentExecutable());
174# ifdef BOOST_PROCESS_USE_V2
175 std::unordered_map<process::environment::key, process::environment::value> env;
176 for (const auto& kv : process::environment::current()) {
177 env[kv.key()] = process::environment::value(kv.value());
178 }
179 env["PATH"] = process::environment::value(current_exe.parent_path().string());
180 executable_ = process::environment::find_executable(name, env);
181# else
182 executable_ = process::search_path(name, {current_exe.parent_path()});
183# endif
184 }
185 if (executable_.empty()) {
186 return Status::IOError("Failed to find '", name, "' in PATH");
187 }
188 return Status::OK();
189#else
190 return Status::NotImplemented("Boost.Process isn't available on this system");
191#endif
192 }
193
194 void SetArgs(const std::vector<std::string>& args) {
195#ifdef BOOST_PROCESS_AVAILABLE

Callers

nothing calls this directly

Calls 8

IOErrorFunction · 0.85
valueFunction · 0.50
OKFunction · 0.50
NotImplementedFunction · 0.50
emptyMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected