MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ exec_command()

std::string MayaFlux::Platform::exec_command ( const char * cmd)
inline

Definition at line 31 of file Process.hpp.

32{
33 std::array<char, 128> buffer {};
34 std::string result;
35
36 using PipeCloser = int (*)(FILE*);
37#ifdef MAYAFLUX_PLATFORM_WINDOWS
38 std::unique_ptr<FILE, PipeCloser> pipe(_popen(cmd, "r"), _pclose);
39#else
40 std::unique_ptr<FILE, PipeCloser> pipe(popen(cmd, "r"), pclose);
41#endif
42
43 if (!pipe)
44 return "";
45
46 while (fgets(buffer.data(), static_cast<int>(buffer.size()), pipe.get())) {
47 result += buffer.data();
48 }
49 return result;
50}

Referenced by MayaFlux::Platform::SystemConfig::get_clang_includes(), and MayaFlux::Platform::SystemConfig::get_clang_resource_dir().

Here is the caller graph for this function: