Fix compile failure under Windows.

* The WAIT_FAILED error enum value in ProcessUtils.h conflicted
   with Win32 API #define names - use CapitalCase enum names
   instead.

 * Add dummy return value for Windows implementation of FileUtils::fileMode()
This commit is contained in:
Robert Knight 2011-09-14 15:57:36 +01:00
parent 9650a492a9
commit 25ab59b361
3 changed files with 16 additions and 15 deletions

View file

@ -83,6 +83,7 @@ int FileUtils::fileMode(const char* path) throw (IOException)
return fileInfo.st_mode;
#else
// not implemented for Windows
return 0;
#endif
}

View file

@ -62,7 +62,7 @@ int ProcessUtils::runSyncUnix(const std::string& executable,
else
{
LOG(Warn,"Failed to get exit status of child " + intToStr(pid));
return WAIT_FAILED;
return WaitFailed;
}
}
#endif
@ -185,13 +185,13 @@ int ProcessUtils::runElevatedLinux(const std::string& executable,
LOG(Info,"Tried to use sudo " + sudoBinary + " with response " + intToStr(result));
if (result != RUN_FAILED)
if (result != RunFailed)
{
return result;
break;
}
}
return RUN_ELEVATED_FAILED;
return RunElevatedFailed;
}
#endif
@ -288,7 +288,7 @@ int ProcessUtils::runElevatedMac(const std::string& executable,
else
{
LOG(Error,"failed to launch elevated process " + intToStr(status));
return RUN_ELEVATED_FAILED;
return RunElevatedFailed;
}
// If we want to know more information about what has happened:
@ -302,12 +302,12 @@ int ProcessUtils::runElevatedMac(const std::string& executable,
else
{
LOG(Error,"failed to get rights to launch elevated process. status: " + intToStr(status));
return RUN_ELEVATED_FAILED;
return RunElevatedFailed;
}
}
else
{
return RUN_ELEVATED_FAILED;
return RunElevatedFailed;
}
}
#endif
@ -358,7 +358,7 @@ int ProcessUtils::runElevatedWindows(const std::string& executable,
if (!ShellExecuteEx(&executeInfo))
{
LOG(Error,"Failed to start with admin priviledges using ShellExecuteEx()");
return RUN_ELEVATED_FAILED;
return RunElevatedFailed;
}
WaitForSingleObject(executeInfo.hProcess, INFINITE);
@ -390,7 +390,7 @@ PLATFORM_PID ProcessUtils::runAsyncUnix(const std::string& executable,
if (execvp(executable.c_str(),argBuffer) == -1)
{
LOG(Error,"error starting child: " + std::string(strerror(errno)));
exit(RUN_FAILED);
exit(RunFailed);
}
}
else
@ -434,7 +434,7 @@ int ProcessUtils::runWindows(const std::string& executable,
if (!result)
{
LOG(Error,"Failed to start child process. " + executable + " Last error: " + intToStr(GetLastError()));
return RUN_FAILED;
return RunFailed;
}
else
{
@ -442,7 +442,7 @@ int ProcessUtils::runWindows(const std::string& executable,
{
if (WaitForSingleObject(processInfo.hProcess,INFINITE) == WAIT_OBJECT_0)
{
DWORD status = WAIT_FAILED;
DWORD status = WaitFailed;
if (GetExitCodeProcess(processInfo.hProcess,&status) != 0)
{
LOG(Error,"Failed to get exit code for process");
@ -452,7 +452,7 @@ int ProcessUtils::runWindows(const std::string& executable,
else
{
LOG(Error,"Failed to wait for process to finish");
return WAIT_FAILED;
return WaitFailed;
}
}
else

View file

@ -16,15 +16,15 @@ class ProcessUtils
/** Status code returned by runElevated() if launching
* the elevated process fails.
*/
RUN_ELEVATED_FAILED = 255,
RunElevatedFailed = 255,
/** Status code returned by runSync() if the application
* cannot be started.
*/
RUN_FAILED = -8,
RunFailed = -8,
/** Status code returned by runSync() if waiting for
* the application to exit and reading its status code fails.
*/
WAIT_FAILED = -1
WaitFailed = -1
};
static PLATFORM_PID currentProcessId();
@ -51,7 +51,7 @@ class ProcessUtils
/** Run a process with administrative privileges and return the
* status code of the process, or 0 on Windows.
*
* Returns RUN_ELEVATED_FAILED if the elevated process could
* Returns RunElevatedFailed if the elevated process could
* not be started.
*/
static int runElevated(const std::string& executable,