1
0
Fork 0

if the process to spawn doesn't contain a path, do a lookup in the host path for it. (#5127)

This commit is contained in:
Wilfried Goesgens 2018-04-18 16:37:47 +02:00 committed by Michael Hackstein
parent 6053056b6a
commit ef6a294a3b
1 changed files with 13 additions and 0 deletions

View File

@ -336,6 +336,19 @@ static char* makeWindowsArgs(ExternalProcess* external) {
if (buf == nullptr) {
return nullptr;
}
if (( external->_executable.find('/') == std::string::npos) &&
( external->_executable.find('\\') == std::string::npos)) {
// oK, this is a binary without path, start the lookup.
char buf[MAX_PATH];
char *pBuf;
DWORD n;
n = SearchPath(nullptr, external->_executable.c_str(), nullptr, MAX_PATH, buf, &pBuf);
if (n > 0) {
external->_executable = std::string(buf, n);
}
}
TRI_ReserveStringBuffer(buf, 1024);
err = appendQuotedArg(buf, external->_executable.c_str());
if (err != TRI_ERROR_NO_ERROR) {