Mercurial > hg > orthanc-webviewer
diff Orthanc/Core/Toolbox.cpp @ 69:fe8dab5c051f
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 07 Aug 2015 21:23:42 +0200 |
parents | 902dedf9882a |
children | f869ea124433 |
line wrap: on
line diff
--- a/Orthanc/Core/Toolbox.cpp Fri Aug 07 21:20:42 2015 +0200 +++ b/Orthanc/Core/Toolbox.cpp Fri Aug 07 21:23:42 2015 +0200 @@ -34,6 +34,7 @@ #include "Toolbox.h" #include "OrthancException.h" +#include "Logging.h" #include <string> #include <stdint.h> @@ -53,13 +54,9 @@ #include <boost/regex.hpp> #endif -#if HAVE_GOOGLE_LOG == 1 -#include <glog/logging.h> -#endif - #if defined(_WIN32) #include <windows.h> -#include <process.h> // For "_spawnvp()" +#include <process.h> // For "_spawnvp()" and "_getpid()" #else #include <unistd.h> // For "execvp()" #include <sys/wait.h> // For "waitpid()" @@ -440,7 +437,7 @@ { return static_cast<uint64_t>(boost::filesystem::file_size(path)); } - catch (boost::filesystem::filesystem_error) + catch (boost::filesystem::filesystem_error&) { throw OrthancException(ErrorCode_InexistentFile); } @@ -1135,7 +1132,7 @@ if (pid == -1) { // Error in fork() -#if HAVE_GOOGLE_LOG == 1 +#if ORTHANC_ENABLE_LOGGING == 1 LOG(ERROR) << "Cannot fork a child process"; #endif @@ -1158,7 +1155,7 @@ if (status != 0) { -#if HAVE_GOOGLE_LOG == 1 +#if ORTHANC_ENABLE_LOGGING == 1 LOG(ERROR) << "System command failed with status code " << status; #endif @@ -1274,5 +1271,14 @@ } } + + int Toolbox::GetProcessId() + { +#if defined(_WIN32) + return static_cast<int>(_getpid()); +#else + return static_cast<int>(getpid()); +#endif + } }