MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / exec

Function exec

src/process.cpp:57–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56template <class F>
57static int exec(const std::string& cmd, const char* type, F f)
58{
59 int ec = 0;
60 if(enabled(MIGRAPHX_TRACE_CMD_EXECUTE{}))
61 std::cout << cmd << std::endl;
62 auto closer = [&](FILE* stream) {
63 auto status = pclose(stream);
64 ec = WIFEXITED(status) ? WEXITSTATUS(status) : 0; // NOLINT
65 };
66 {
67 // TODO: Use execve instead of popen
68 std::unique_ptr<FILE, decltype(closer)> pipe(popen(cmd.c_str(), type), closer); // NOLINT
69 if(not pipe)
70 MIGRAPHX_THROW("popen() failed: " + cmd);
71 f(pipe.get());
72 }
73 return ec;
74}
75
76static int exec(const std::string& cmd, const std::function<void(const char*)>& std_out)
77{

Callers 4

template_evalFunction · 0.85
template_evalFunction · 0.85
check_execMethod · 0.85
run_fileFunction · 0.85

Calls 15

quote_stringFunction · 0.85
resizeMethod · 0.80
get_write_handleMethod · 0.80
get_read_handleMethod · 0.80
close_write_handleMethod · 0.80
close_read_handleMethod · 0.80
enabledFunction · 0.70
to_stringFunction · 0.50
getMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected