mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-13 16:21:47 +02:00
Don't close a null stream
This commit is contained in:
parent
9442d2d202
commit
af3300ccca
1 changed files with 6 additions and 1 deletions
|
@ -72,7 +72,12 @@ namespace strutils = utils::string;
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
static std::string execGetOutput(const std::string& cmd)
|
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)
|
if (!pipe)
|
||||||
return "";
|
return "";
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue