21 #ifdef HAVE_MALLOPT_ARENA_MAX 39 std::string escaped = arg;
41 return "'" + escaped +
"'";
46 void runCommand(
const std::string& strCommand)
48 if (strCommand.empty())
return;
50 int nErr = ::system(strCommand.c_str());
52 int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,
wchar_t>().from_bytes(strCommand).c_str());
55 LogPrintf(
"runCommand error: system(%s) returned %d\n", strCommand, nErr);
61 #ifdef HAVE_MALLOPT_ARENA_MAX 67 if (
sizeof(
void*) == 4) {
68 mallopt(M_ARENA_MAX, 1);
73 #if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) 76 }
catch (
const std::runtime_error&) {
77 setenv(
"LC_ALL",
"C.UTF-8", 1);
81 SetConsoleCP(CP_UTF8);
82 SetConsoleOutputCP(CP_UTF8);
86 constexpr mode_t private_umask = 0077;
96 int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
97 if (
ret != NO_ERROR || LOBYTE(wsadata.wVersion ) != 2 || HIBYTE(wsadata.wVersion) != 2)
105 return std::thread::hardware_concurrency();
void ReplaceAll(std::string &in_out, const std::string &search, const std::string &substitute)
const int64_t nStartupTime
std::string ShellEscape(const std::string &arg)
int64_t GetTime()
DEPRECATED, see GetTime.
int GetNumCores()
Return the number of cores available on the current system.