[ALL] Merge master (#447)
This commit is contained in:
@@ -13,6 +13,14 @@ namespace tools
|
||||
{
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#define popen _popen
|
||||
#define pclose _pclose
|
||||
#endif
|
||||
|
||||
#ifndef WEXITSTATUS
|
||||
#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) & 255)
|
||||
#endif
|
||||
|
||||
int exec(const std::string& cmd, std::string& result) {
|
||||
char buffer[128];
|
||||
|
@@ -33,19 +33,10 @@ namespace tools
|
||||
|
||||
inline std::string getenv(const char * name)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
char* cache_path = 0;
|
||||
std::size_t sz = 0;
|
||||
_dupenv_s(&cache_path, &sz, name);
|
||||
#else
|
||||
const char * cstr = std::getenv(name);
|
||||
#endif
|
||||
const char * cstr = std::getenv(name);
|
||||
if(!cstr)
|
||||
return "";
|
||||
std::string result(cstr);
|
||||
#ifdef _MSC_VER
|
||||
free(cache_path);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user