32 "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
37 std::string saved_path;
38 bool had_path =
false;
41 const char *cur = getenv(
"PATH");
49 setenv(
"PATH", new_path.c_str(), 1);
52 int rv = system(cmdline.c_str());
56 setenv(
"PATH", saved_path.c_str(), 1);
67 if (name.find(
'/') != std::string::npos)
68 return access(name.c_str(), X_OK) == 0 ? name :
"";
79 std::string check =
"command -v '" + name +
"' >/dev/null 2>&1";
90 if (WIFSIGNALED(rv) && WTERMSIG(rv) == SIGINT) {
91 InterruptPending =
true;
92 QueryCancelPending =
true;
93 CHECK_FOR_INTERRUPTS();
96 return rv == 0 ? name :
"";
103 return tool +
" could not be invoked (system() returned -1)";
105 return tool +
" terminated by signal "
106 + std::to_string(WTERMSIG(rv));
108 int code = WEXITSTATUS(rv);
110 return tool +
" was not found at runtime (shell exit 127); "
111 "install it or add its directory to provsql.tool_search_path";
113 return tool +
" is not executable (shell exit 126); "
114 "check permissions on the binary";
115 return tool +
" exited with status " + std::to_string(code);
117 return tool +
" failed with raw status " + std::to_string(rv);
char * provsql_tool_search_path
Colon-separated directory list prepended to PATH when invoking external tools (d4,...
Core types, constants, and utilities shared across ProvSQL.