diff --git a/common/utils.hpp b/common/utils.hpp index 5a1ec1fa..8f8c6ff2 100644 --- a/common/utils.hpp +++ b/common/utils.hpp @@ -72,7 +72,12 @@ namespace strutils = utils::string; #ifndef WINDOWS static std::string execGetOutput(const std::string& cmd) { - std::shared_ptr<::FILE> pipe(popen((cmd + " 2> /dev/null").c_str(), "r"), pclose); + std::shared_ptr<::FILE> pipe(popen((cmd + " 2> /dev/null").c_str(), "r"), + [](::FILE* stream) + { + if (stream) + pclose(stream); + }); if (!pipe) return ""; char buffer[1024];