mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-28 17:57:05 +02:00
Reformat source
This commit is contained in:
parent
d4bdbc3844
commit
f5e75453ea
2 changed files with 13 additions and 17 deletions
|
@ -72,12 +72,10 @@ 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"),
|
std::shared_ptr<::FILE> pipe(popen((cmd + " 2> /dev/null").c_str(), "r"), [](::FILE* stream) {
|
||||||
[](::FILE* stream)
|
if (stream != nullptr)
|
||||||
{
|
pclose(stream);
|
||||||
if (stream != nullptr)
|
});
|
||||||
pclose(stream);
|
|
||||||
});
|
|
||||||
if (!pipe)
|
if (!pipe)
|
||||||
return "";
|
return "";
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
|
|
|
@ -54,18 +54,16 @@ template <typename Rep, typename Period>
|
||||||
void wait(boost::asio::steady_timer& timer, const std::chrono::duration<Rep, Period>& duration, std::function<void()> handler)
|
void wait(boost::asio::steady_timer& timer, const std::chrono::duration<Rep, Period>& duration, std::function<void()> handler)
|
||||||
{
|
{
|
||||||
timer.expires_after(duration);
|
timer.expires_after(duration);
|
||||||
timer.async_wait(
|
timer.async_wait([handler = std::move(handler)](const boost::system::error_code& ec) {
|
||||||
[handler = std::move(handler)](const boost::system::error_code& ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
if (ec)
|
LOG(ERROR, LOG_TAG) << "Error during async wait: " << ec.message() << "\n";
|
||||||
{
|
}
|
||||||
LOG(ERROR, LOG_TAG) << "Error during async wait: " << ec.message() << "\n";
|
else
|
||||||
}
|
{
|
||||||
else
|
handler();
|
||||||
{
|
}
|
||||||
handler();
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue