Don't close a null stream

This commit is contained in:
badaix 2022-09-07 17:09:33 +02:00
parent 9442d2d202
commit af3300ccca

View file

@ -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];